From: Eric Leblond Date: Tue, 20 Nov 2012 09:57:16 +0000 (+0100) Subject: unix runmode: improve JSON handling X-Git-Tag: suricata-1.4rc1~27 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=refs%2Fpull%2F215%2Fhead;p=thirdparty%2Fsuricata.git unix runmode: improve JSON handling The jansson function with new in their name take care of ref counting. The this patch fixes a memory leak. --- diff --git a/src/runmode-unix-socket.c b/src/runmode-unix-socket.c index c835573fe5..870fa34a4f 100644 --- a/src/runmode-unix-socket.c +++ b/src/runmode-unix-socket.c @@ -97,7 +97,7 @@ static TmEcode UnixSocketPcapFilesList(json_t *cmd, json_t* answer, void *data) return TM_ECODE_FAILED; } TAILQ_FOREACH(file, &this->files, next) { - json_array_append(jarray, json_string(file->filename)); + json_array_append_new(jarray, json_string(file->filename)); i++; } json_object_set_new(jdata, "count", json_integer(i));