vl/buffer: add sanity check after CALLOC_STRUCT
authorEmil Velikov <emil.l.velikov@gmail.com>
Sat, 17 Aug 2013 20:17:18 +0000 (21:17 +0100)
committerChristian König <christian.koenig@amd.com>
Mon, 19 Aug 2013 16:32:08 +0000 (18:32 +0200)
Check if we have successfully allocated memory.

Reviewed-by: Christian König <christian.koenig@amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
src/gallium/auxiliary/vl/vl_video_buffer.c

index 3b599fcd12f444134c316e62cc382542484f8e16..e2cac0a654bb0e5fa290ab496d98e2097b9e641a 100644 (file)
@@ -492,6 +492,8 @@ vl_video_buffer_create_ex2(struct pipe_context *pipe,
    unsigned i;
 
    buffer = CALLOC_STRUCT(vl_video_buffer);
+   if (!buffer)
+      return NULL;
 
    buffer->base = *tmpl;
    buffer->base.context = pipe;