From 5920b6b67988fc3977f43b39d8546cc20247bf31 Mon Sep 17 00:00:00 2001 From: Zack Rusin Date: Sat, 20 Jun 2009 21:36:40 -0400 Subject: pipebuffer: handle possible null pointer dereference reported by clang static analyzer --- src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c | 2 ++ src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c | 2 ++ 2 files changed, 4 insertions(+) (limited to 'src/gallium/auxiliary') diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c index 0760d607161..6bdce5fcb06 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c +++ b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c @@ -53,6 +53,8 @@ static INLINE struct malloc_buffer * malloc_buffer(struct pb_buffer *buf) { assert(buf); + if (!buf) + return NULL; assert(buf->vtbl == &malloc_buffer_vtbl); return (struct malloc_buffer *)buf; } diff --git a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c index bc3093f620f..cb32d251367 100644 --- a/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c +++ b/src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c @@ -74,6 +74,8 @@ static INLINE struct pb_ondemand_buffer * pb_ondemand_buffer(struct pb_buffer *buf) { assert(buf); + if (!buf) + return NULL; assert(buf->vtbl == &pb_ondemand_buffer_vtbl); return (struct pb_ondemand_buffer *)buf; } -- cgit v1.2.3