[PATCH libdrm 1/3] libdrm: Plug memory leaks

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

drmModeFreeResources() always leaked some memory.
drmModeGetPlaneResources() and drmModeGetPlane() leaked in one error
path.

Signed-off-by: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>
---
 xf86drmMode.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/xf86drmMode.c b/xf86drmMode.c
index da7b462..e67ed4a 100644
--- a/xf86drmMode.c
+++ b/xf86drmMode.c
@@ -96,6 +96,10 @@ void drmModeFreeResources(drmModeResPtr ptr)
 	if (!ptr)
 		return;
 
+	drmFree(ptr->fbs);
+	drmFree(ptr->crtcs);
+	drmFree(ptr->connectors);
+	drmFree(ptr->encoders);
 	drmFree(ptr);
 
 }
@@ -898,6 +902,7 @@ retry:
 				 ovr.count_format_types, sizeof(uint32_t));
 	if (ovr.count_format_types && !r->formats) {
 		drmFree(r->formats);
+		drmFree(r);
 		r = 0;
 	}
 
@@ -951,6 +956,7 @@ retry:
 				  res.count_planes, sizeof(uint32_t));
 	if (res.count_planes && !r->planes) {
 		drmFree(r->planes);
+		drmFree(r);
 		r = 0;
 	}
 
-- 
1.7.3.4

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel



[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux