[PATCH 02/15] xkb: Fix memory leak if opening file fails

Pauli Nieminen ext-pauli.nieminen at nokia.com
Tue Jul 27 05:09:43 PDT 2010


If fopen fails pointer in buf would be overwriten with a new pointer.

Signed-off-by: Pauli Nieminen <ext-pauli.nieminen at nokia.com>
---
 xkb/ddxList.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 2256424..39bd739 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -161,6 +161,7 @@ char	tmpname[PATH_MAX];
 	}
 	if (!in) {
 	    haveDir= FALSE;
+	    free(buf);
 	    buf = Xprintf(
 		"'%s/xkbcomp' '-R%s/%s' -w %ld -l -vlfhpR '%s'" W32_tmparg,
                 XkbBinDirectory,XkbBaseDirectory,componentDirs[what],(long)
@@ -176,6 +177,7 @@ char	tmpname[PATH_MAX];
 	}
 	if (!in) {
 	    haveDir= FALSE;
+	    free(buf);
 	    buf = Xprintf(
 		"xkbcomp -R%s -w %ld -l -vlfhpR '%s'" W32_tmparg,
                 componentDirs[what],(long)
-- 
1.6.3.3



More information about the xorg-devel mailing list