Mesa (master): vl/buffer: add sanity check after CALLOC_STRUCT

Christian König deathsimple at kemper.freedesktop.org
Mon Aug 19 16:32:25 UTC 2013


Module: Mesa
Branch: master
Commit: 5354d2e76a929a2bb898005ef4a19a68580bd922
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5354d2e76a929a2bb898005ef4a19a68580bd922

Author: Emil Velikov <emil.l.velikov at gmail.com>
Date:   Sat Aug 17 21:17:18 2013 +0100

vl/buffer: add sanity check after CALLOC_STRUCT

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 files changed, 2 insertions(+), 0 deletions(-)

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;




More information about the mesa-commit mailing list