[Spice-devel] patch[1/1] fix a memory leak in qxl_screen_init

bigclouds bigclouds at 163.com
Wed Nov 6 01:37:07 PST 2013


hi, it allocate twice memory for qxl->uxa in function qxl_screen_init and qxl_uxa_init
-----------------
diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 91ba6c2..6be61e4 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -746,7 +746,9 @@ qxl_screen_init (SCREEN_INIT_ARGS_DECL)
     }
     
     qxl->uxa = uxa_driver_alloc ();
-    
+    if (qxl->uxa == NULL)
+return FALSE;
+
 #ifndef XSPICE
     qxl->io_pages = (void *)((unsigned long)qxl->ram);
     qxl->io_pages_physical = (void *)((unsigned long)qxl->ram_physical);
diff --git a/src/qxl_uxa.c b/src/qxl_uxa.c
index 875d663..79dfe03 100644
--- a/src/qxl_uxa.c
+++ b/src/qxl_uxa.c
@@ -546,10 +546,6 @@ qxl_uxa_init (qxl_screen_t *qxl, ScreenPtr screen)
 return FALSE;
 #endif
 
-    qxl->uxa = uxa_driver_alloc ();
-    if (qxl->uxa == NULL)
-return FALSE;
-
     memset (qxl->uxa, 0, sizeof (*qxl->uxa));
 
     qxl->uxa->uxa_major = 1;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20131106/d8a78a37/attachment.html>


More information about the Spice-devel mailing list