[PATCH 13/25] [libx11] Variable "table" goes out of scope

Erkki Seppälä erkki.seppala at vincit.fi
Mon Jan 31 03:07:20 PST 2011


The NEWTABLE macro missed freeing its allocated memory on subsequent memory allocation errors. Added call to Xfree.

Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira at nokia.com>
Signed-off-by: Erkki Seppälä <erkki.seppala at vincit.fi>
---
 src/Xrm.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/src/Xrm.c b/src/Xrm.c
index 21f0af3..3e68c37 100644
--- a/src/Xrm.c
+++ b/src/Xrm.c
@@ -842,8 +842,10 @@ static void PutEntry(
 	nprev = NodeBuckets(table); \
     } else { \
 	table->leaf = 1; \
-	if (!(nprev = (NTable *)Xmalloc(sizeof(VEntry *)))) \
+	if (!(nprev = (NTable *)Xmalloc(sizeof(VEntry *)))) {\
+	    Xfree(table); \
 	    return; \
+        } \
 	((LTable)table)->buckets = (VEntry *)nprev; \
     } \
     *nprev = (NTable)NULL; \
-- 
1.7.0.4



More information about the xorg-devel mailing list