summaryrefslogtreecommitdiff
path: root/src/gallium/auxiliary/pipebuffer
diff options
context:
space:
mode:
authorZack Rusin <zack@kde.org>2009-06-20 21:36:40 -0400
committerZack Rusin <zack@kde.org>2009-07-06 17:21:37 -0400
commit5920b6b67988fc3977f43b39d8546cc20247bf31 (patch)
treec58144fc844c7c6450e9d3284067f623ac31604b /src/gallium/auxiliary/pipebuffer
parentf311893bf4cd4e20e5b43fa404c4a2f656791943 (diff)
pipebuffer: handle possible null pointer dereference
reported by clang static analyzer
Diffstat (limited to 'src/gallium/auxiliary/pipebuffer')
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c2
-rw-r--r--src/gallium/auxiliary/pipebuffer/pb_bufmgr_ondemand.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c b/src/gallium/auxiliary/pipebuffer/pb_buffer_malloc.c
index 0760d60716..6bdce5fcb0 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 bc3093f620..cb32d25136 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;
}