From: Phil Sutter Date: Thu, 17 Aug 2017 17:09:29 +0000 (+0200) Subject: ifstat: Fix memleak in dump_kern_db() for json output X-Git-Tag: v4.13.0~64 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b530cef0e3bbd27510e19f5f720a7ec94f3fa723;p=thirdparty%2Fiproute2.git ifstat: Fix memleak in dump_kern_db() for json output Looks like this was forgotten when converting to common json output formatter. Fixes: fcc16c2287bf8 ("provide common json output formatter") Signed-off-by: Phil Sutter --- diff --git a/misc/ifstat.c b/misc/ifstat.c index 8fa354265..1be21703b 100644 --- a/misc/ifstat.c +++ b/misc/ifstat.c @@ -535,8 +535,12 @@ static void dump_kern_db(FILE *fp) else print_one_if(fp, n, n->val); } - if (json_output) - fprintf(fp, "\n} }\n"); + if (jw) { + jsonw_end_object(jw); + + jsonw_end_object(jw); + jsonw_destroy(&jw); + } } static void dump_incr_db(FILE *fp)