Commit afd1d4eb authored by Erkki Seppälä's avatar Erkki Seppälä Committed by Ulrich Sibiller

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: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Reviewed-by: 's avatarAnder Conselvan de Oliveira <ander.conselvan-de-oliveira@nokia.com> Signed-off-by: 's avatarErkki Seppälä <erkki.seppala@vincit.fi> Signed-off-by: 's avatarAlan Coopersmith <alan.coopersmith@oracle.com> Backported-to-NX-by: 's avatarUlrich Sibiller <uli42@gmx.de>
parent 1ac1b691
......@@ -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; \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment