[PATCHv3 08/14] dix: fix memory leak in SetDefaultFontPath

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


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

diff --git a/dix/dixfonts.c b/dix/dixfonts.c
index 71689cf..fbac124 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