[Mesa-dev] [PATCH 4/7] vl/buffer: add sanity check after CALLOC_STRUCT

Emil Velikov emil.l.velikov at gmail.com
Mon Aug 19 09:00:07 PDT 2013


Check if we have successfully allocated memory.

Reviewed-by: Christian König <christian.koenig at amd.com>
Signed-off-by: Emil Velikov <emil.l.velikov at gmail.com>
---
 src/gallium/auxiliary/vl/vl_video_buffer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c b/src/gallium/auxiliary/vl/vl_video_buffer.c
index 3b599fc..e2cac0a 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -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;
-- 
1.8.3.4



More information about the mesa-dev mailing list