]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
unix runmode: improve JSON handling 215/head
authorEric Leblond <eric@regit.org>
Tue, 20 Nov 2012 09:57:16 +0000 (10:57 +0100)
committerEric Leblond <eric@regit.org>
Tue, 20 Nov 2012 10:05:47 +0000 (11:05 +0100)
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

index c835573fe524c66dfc1cab736203a79e786d3875..870fa34a4f63167bb32f652a52d546860af77c8f 100644 (file)
@@ -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));