[Spice-devel] [PATCH 4/9] qxl: fix memory leak on driver exit.

Dave Airlie airlied at gmail.com
Mon Feb 25 20:32:07 PST 2013


We were leaking two allocations on driver exit.

Signed-off-by: Dave Airlie <airlied at redhat.com>
---
 src/qxl_driver.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/qxl_driver.c b/src/qxl_driver.c
index 9a8de82..73c7534 100644
--- a/src/qxl_driver.c
+++ b/src/qxl_driver.c
@@ -258,10 +258,15 @@ qxl_unmap_memory (qxl_screen_t *qxl)
     {
 	qxl_mem_free_all (qxl->mem);
 	qxl_drop_image_cache (qxl);
+	free(qxl->mem);
+	qxl->mem = NULL;
     }
     
-    if (qxl->surf_mem)
+    if (qxl->surf_mem) {
 	qxl_mem_free_all (qxl->surf_mem);
+	free(qxl->surf_mem);
+	qxl->surf_mem = NULL;
+    }
     
     unmap_memory_helper (qxl);
     qxl->ram = qxl->ram_physical = qxl->vram = qxl->rom = NULL;
-- 
1.8.1.2



More information about the Spice-devel mailing list