[PATCH 07/10] mi: fix memory leak in miZeroLine

Tiago Vignatti tiago.vignatti at nokia.com
Tue Mar 29 08:12:33 PDT 2011


Signed-off-by: Tiago Vignatti <tiago.vignatti at nokia.com>
---
 mi/mizerline.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/mi/mizerline.c b/mi/mizerline.c
index 07cfbe1..7077b51 100644
--- a/mi/mizerline.c
+++ b/mi/mizerline.c
@@ -157,9 +157,11 @@ miZeroLine(
     list_len = (height >= width) ? height : width;
     pspanInit = malloc(list_len * sizeof(DDXPointRec));
     pwidthInit = malloc(list_len * sizeof(int));
-    if (!pspanInit || !pwidthInit)
+    if (!pspanInit || !pwidthInit) {
+	free(pspanInit);
+	free(pwidthInit);
 	return;
-
+    }
     Nspans = 0;
     new_span = TRUE;
     spans  = pspanInit - 1;
-- 
1.7.0.4



More information about the xorg-devel mailing list