diff options
author | Erkki Seppälä <erkki.seppala@vincit.fi> | 2011-01-31 14:02:05 +0200 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2011-02-01 23:46:06 -0800 |
commit | 3fae16c64d6ef76fd4a25a54c7f7de76596457db (patch) | |
tree | 53b183a465437b495cf44da632e5e35617cb42b3 | |
parent | 7110ac653349a23c80c365f11f6270dc27c8975a (diff) |
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>
-rw-r--r-- | src/Xrm.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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; \ |