[Spice-devel] [PATHCH win-qxl 6/8] display/surface.h: make GetSurfaceId NULL safe

Alon Levy alevy at redhat.com
Thu Apr 7 09:10:43 PDT 2011


---
 display/surface.h |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/display/surface.h b/display/surface.h
index d741690..e212c46 100644
--- a/display/surface.h
+++ b/display/surface.h
@@ -26,6 +26,9 @@ static _inline UINT32 GetSurfaceId(SURFOBJ *surf)
 {
     SurfaceInfo *surface;
 
+    if (!surf || !surf->dhsurf) {
+        return (UINT32)-1;
+    }
     surface = (SurfaceInfo *)surf->dhsurf;
     return GetSurfaceIdFromInfo(surface);
 }
-- 
1.7.4.2



More information about the Spice-devel mailing list