From c33a13bbaba90fae0fc95c6e21824e77817d6960 Mon Sep 17 00:00:00 2001 From: Bryce Harrington Date: Wed, 12 Jan 2011 10:06:12 -0800 Subject: [PATCH] [r300] Null pointer check for buffer deref in gallium winsys radeon_drm_bufmgr_create_buffer_from_handle() can return NULL buffers sometimes (seen when alt-tabbing in compiz). Avoid dereferencing the buffer pointer in this case. Ref.: https://bugs.launchpad.net/ubuntu/+source/mesa/+bug/691653 Also: https://bugzilla.redhat.com/show_bug.cgi?id=660143 Signed-off-by: Bryce Harrington --- src/gallium/winsys/radeon/drm/radeon_r300.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/src/gallium/winsys/radeon/drm/radeon_r300.c b/src/gallium/winsys/radeon/drm/radeon_r300.c index bacf181..0ebc578 100644 --- a/src/gallium/winsys/radeon/drm/radeon_r300.c +++ b/src/gallium/winsys/radeon/drm/radeon_r300.c @@ -117,7 +117,7 @@ static struct r300_winsys_buffer *radeon_r300_winsys_buffer_from_handle(struct r if (stride) *stride = whandle->stride; - if (size) + if (size && _buf) *size = _buf->base.size; return (struct r300_winsys_buffer*)_buf; -- 1.7.1