[PATCH 09/10] xkb: fix memory leak in XkbDDXListComponent

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


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

diff --git a/xkb/ddxList.c b/xkb/ddxList.c
index 9623cb6..3d301d8 100644
--- a/xkb/ddxList.c
+++ b/xkb/ddxList.c
@@ -222,8 +222,10 @@ char	tmpname[PATH_MAX];
     list->nFound[what]= 0;
     free(buf);
     buf = malloc(PATH_MAX * sizeof(char));
-    if (!buf)
+    if (!buf) {
+        fclose(in);
         return BadAlloc;
+    }
     while ((status==Success)&&((tmp=fgets(buf,PATH_MAX,in))!=NULL)) {
 	unsigned flags;
 	register unsigned int i;
-- 
1.7.0.4



More information about the xorg-devel mailing list