[Libva] [PATCH] Fix memory leaks in libva

gimli gimli at dark-green.com
Fri Jun 10 23:54:00 PDT 2011


This patch fixes the following memory leaks in libva :

1.) The dri drawables are allocated but not freed
2.) The drm buffer manager is allocated but not freed
3.) The device name is allocated but not freed

Signed-off-by: Edgar Hucek <gimli at dark-green.com>
-------------- next part --------------
diff -uNr libva/i965_drv_video/i965_drv_video.c libva-build/i965_drv_video/i965_drv_video.c
--- libva/i965_drv_video/i965_drv_video.c	2011-06-11 06:57:22.363362748 +0200
+++ libva-build/i965_drv_video/i965_drv_video.c	2011-06-11 07:56:59.903556772 +0200
@@ -2354,6 +2354,7 @@
     i965_destroy_heap(&i965->context_heap, i965_destroy_context);
     i965_destroy_heap(&i965->config_heap, i965_destroy_config);
 
+    free_drawable_hashtable(ctx);
     free(ctx->pDriverData);
     ctx->pDriverData = NULL;
 
diff -uNr libva/i965_drv_video/intel_memman.c libva-build/i965_drv_video/intel_memman.c
--- libva/i965_drv_video/intel_memman.c	2011-06-11 06:57:22.366696082 +0200
+++ libva-build/i965_drv_video/intel_memman.c	2011-06-11 08:32:51.450340125 +0200
@@ -44,5 +44,6 @@
 Bool 
 intel_memman_terminate(struct intel_driver_data *intel)
 {
+    drm_intel_bufmgr_destroy(intel->bufmgr);
     return True;
 }
diff -uNr libva/va/x11/dri2_util.c libva-build/va/x11/dri2_util.c
--- libva/va/x11/dri2_util.c	2011-06-11 06:57:22.406696084 +0200
+++ libva-build/va/x11/dri2_util.c	2011-06-11 07:58:52.576896215 +0200
@@ -193,6 +193,9 @@
     dri_state->close = dri2Close;
     gsDRI2SwapAvailable = (minor >= 2);
 
+    if (device_name)
+        Xfree(device_name);
+
     return True;
 
 err_out:


More information about the Libva mailing list