[PATCH 06/11] dix: fix memory leak in SetDefaultFontPath

Tiago Vignatti tiago.vignatti at nokia.com
Fri Mar 25 11:41:48 PDT 2011


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

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 71689cf..793ce08 100644
--- a/dix/dixfonts.c
+++ b/dix/dixfonts.c
@@ -1815,8 +1815,10 @@ SetDefaultFontPath(char *path)
     /* get enough for string, plus values -- use up commas */
     len = strlen(temp_path) + 1;
     nump = cp = newpath = malloc(len);
-    if (!newpath)
+    if (!newpath) {
+        free(temp_path);
 	return BadAlloc;
+    }
     pp = (unsigned char *) temp_path;
     cp++;
     while (*pp) {
-- 
1.7.0.4



More information about the xorg-devel mailing list