From 6b3ebc810d749cce61501dea6ee1890aa80288ab Mon Sep 17 00:00:00 2001 From: Eric Leblond Date: Tue, 20 Nov 2012 10:57:16 +0100 Subject: [PATCH] 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. --- src/runmode-unix-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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)); -- 2.47.3