From 42c327adc451c2f6c1e668e4c84125def9f5a2c6 Mon Sep 17 00:00:00 2001 From: Jason Ish Date: Sat, 4 May 2019 07:48:46 -0600 Subject: [PATCH] filestore: fix leak in contructing json Use json_array_append_new instead of json_array_append to transfer ownership of the integer object to jansson so it gets freed. Redmine issue: https://redmine.openinfosecfoundation.org/issues/2961 --- src/output-json-file.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/output-json-file.c b/src/output-json-file.c index 3283a2f310..79004fe044 100644 --- a/src/output-json-file.c +++ b/src/output-json-file.c @@ -156,7 +156,7 @@ json_t *JsonBuildFileInfoRecord(const Packet *p, const File *ff, } for (uint32_t i = 0; ff->sid != NULL && i < ff->sid_cnt; i++) { - json_array_append(sig_ids, json_integer(ff->sid[i])); + json_array_append_new(sig_ids, json_integer(ff->sid[i])); } json_object_set_new(fjs, "sid", sig_ids); -- 2.47.2