aboutsummaryrefslogtreecommitdiff
path: root/nx-X11/lib
diff options
context:
space:
mode:
authorErkki Seppälä <erkki.seppala@vincit.fi>2011-01-31 14:02:05 +0200
committerUlrich Sibiller <uli42@gmx.de>2016-10-19 21:40:24 +0200
commitafd1d4eb5378d3c7419021b33e9c55619c364c1a (patch)
tree4fcf66c228f2c0ab2baf823845021de9d37e6aaf /nx-X11/lib
parent1ac1b691d24af84db4061ca7b3fffb0f588e8f3c (diff)
downloadnx-libs-afd1d4eb5378d3c7419021b33e9c55619c364c1a.tar.gz
nx-libs-afd1d4eb5378d3c7419021b33e9c55619c364c1a.tar.bz2
nx-libs-afd1d4eb5378d3c7419021b33e9c55619c364c1a.zip
Xrm: NEWTABLE had a memory leak after a memory allocation error
The NEWTABLE macro missed freeing its allocated memory on subsequent memory allocation errors. Added call to Xfree. Variable "table" goes out of scope Reviewed-by: Alan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: Ander Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Signed-off-by: Erkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: Ulrich Sibiller <uli42@gmx.de>
Diffstat (limited to 'nx-X11/lib')
-rw-r--r--nx-X11/lib/X11/Xrm.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/nx-X11/lib/X11/Xrm.c b/nx-X11/lib/X11/Xrm.c
index 818e72906..2900816c1 100644
--- a/nx-X11/lib/X11/Xrm.c
+++ b/nx-X11/lib/X11/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; \