From faf94f6eeaccf093025ad6f1e2bd9df6eafbe969 Mon Sep 17 00:00:00 2001 From: Patrick Rudolph Date: Thu, 15 Jan 2015 09:18:25 +0100 Subject: [PATCH] st/nine: Missing sanity check for CALLOC return E_OUTOFMEMORY if allocation of usage_map fails Reviewed-by: Axel Davy Signed-off-by: Patrick Rudolph --- src/gallium/state_trackers/nine/vertexdeclaration9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gallium/state_trackers/nine/vertexdeclaration9.c b/src/gallium/state_trackers/nine/vertexdeclaration9.c index 4aea1169be3..08b95e22fc4 100644 --- a/src/gallium/state_trackers/nine/vertexdeclaration9.c +++ b/src/gallium/state_trackers/nine/vertexdeclaration9.c @@ -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) { -- 2.30.2