From: Vinson Lee Date: Fri, 27 Nov 2009 04:02:49 +0000 (-0500) Subject: svga: Prevent potential null pointer dereference in vmw_surface.c. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=69671df74c8b45f08149c248a7ee905912aec2b0;p=mesa.git svga: Prevent potential null pointer dereference in vmw_surface.c. --- diff --git a/src/gallium/winsys/drm/vmware/core/vmw_surface.c b/src/gallium/winsys/drm/vmware/core/vmw_surface.c index c19e556df9f..64eb32f8b94 100644 --- a/src/gallium/winsys/drm/vmware/core/vmw_surface.c +++ b/src/gallium/winsys/drm/vmware/core/vmw_surface.c @@ -37,11 +37,13 @@ vmw_svga_winsys_surface_reference(struct vmw_svga_winsys_surface **pdst, { struct pipe_reference *src_ref; struct pipe_reference *dst_ref; - struct vmw_svga_winsys_surface *dst = *pdst; - + struct vmw_svga_winsys_surface *dst; + if(pdst == NULL || *pdst == src) return; - + + dst = *pdst; + src_ref = src ? &src->refcnt : NULL; dst_ref = dst ? &dst->refcnt : NULL;