[Spice-devel] [PATCH 4/7] Free surface id if surface construction failed

alexl at redhat.com alexl at redhat.com
Tue Aug 24 01:41:11 PDT 2010


From: Alexander Larsson <alexl at redhat.com>

---
 display/driver.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/display/driver.c b/display/driver.c
index 46df8f2..1c8e1f6 100644
--- a/display/driver.c
+++ b/display/driver.c
@@ -1248,14 +1248,16 @@ HBITMAP APIENTRY DrvCreateDeviceBitmap(DHPDEV dhpdev, SIZEL size, ULONG format)
     hbitmap = CreateDeviceBitmap(pdev, size, pdev->bitmap_format, &phys_mem, &base_mem, surface_id,
                                  DEVICE_BITMAP_ALLOCATION_TYPE_VRAM);
     if (!hbitmap) {
-        goto out_error;
+        goto out_error2;
     }
 
     return hbitmap;
 
     // to optimize the failure case
+out_error2:
+    FreeSurface(pdev, surface_id);
 out_error:
-	return 0; 
+    return 0;
 }
 
 VOID APIENTRY DrvDeleteDeviceBitmap(DHSURF dhsurf)
-- 
1.7.2.1



More information about the Spice-devel mailing list