Discussion:
[PATCH] - memory leak in ReadBongoConfiguration()
Patrick Felt
2009-04-09 04:19:58 UTC
Permalink
I went through the json code and it appeared to me that it used StringBuilder() which does malloc() and memcpy() type calls. It seemed to me that we needed to free pconfig when we were done with it. I didn't want to commit as I could be wrong on this.

I've still got a leak in the rules agent somewhere, but I don't know how big yet.

fat

Index: src/libs/nmap/bongoagent.c
===================================================================
--- src/libs/nmap/bongoagent.c (revision 1016)
+++ src/libs/nmap/bongoagent.c (working copy)
@@ -241,7 +241,7 @@

BOOL
ReadBongoConfiguration(BongoConfigItem *config, char *filename) {
- unsigned char *pconfig;
+ unsigned char *pconfig = NULL;
BongoJsonNode *node = NULL;
BOOL retcode;

@@ -256,6 +256,7 @@
}

if (node) BongoJsonNodeFree(node);
+ if (pconfig) MemFree(pconfig);
return retcode;
}

Loading...