st/nine: Missing sanity check for CALLOC return E_OUTOFMEMORY if allocation of usage_...
authorPatrick Rudolph <siro@das-labor.org>
Thu, 15 Jan 2015 08:18:25 +0000 (09:18 +0100)
committerAxel Davy <axel.davy@ens.fr>
Thu, 5 Feb 2015 23:07:19 +0000 (00:07 +0100)
Reviewed-by: Axel Davy <axel.davy@ens.fr>
Signed-off-by: Patrick Rudolph <siro@das-labor.org>
src/gallium/state_trackers/nine/vertexdeclaration9.c

index 4aea1169be317c465d81b198b77b4364b4b2798e..08b95e22fc42969748faec0d12f86536255405ac 100644 (file)
@@ -192,7 +192,7 @@ NineVertexDeclaration9_ctor( struct NineVertexDeclaration9 *This,
     This->decls = CALLOC(This->nelems+1, sizeof(D3DVERTEXELEMENT9));
     This->elems = CALLOC(This->nelems, sizeof(struct pipe_vertex_element));
     This->usage_map = CALLOC(This->nelems, sizeof(uint16_t));
-    if (!This->decls || !This->elems) { return E_OUTOFMEMORY; }
+    if (!This->decls || !This->elems || !This->usage_map) { return E_OUTOFMEMORY; }
     memcpy(This->decls, pElements, sizeof(D3DVERTEXELEMENT9)*(This->nelems+1));
 
     for (i = 0; i < This->nelems; ++i) {