]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
ifstat: Fix memleak in dump_kern_db() for json output
authorPhil Sutter <phil@nwl.cc>
Thu, 17 Aug 2017 17:09:29 +0000 (19:09 +0200)
committerStephen Hemminger <stephen@networkplumber.org>
Fri, 18 Aug 2017 16:39:52 +0000 (09:39 -0700)
Looks like this was forgotten when converting to common json output
formatter.

Fixes: fcc16c2287bf8 ("provide common json output formatter")
Signed-off-by: Phil Sutter <phil@nwl.cc>
misc/ifstat.c

index 8fa354265a9a1a1fb55710b47ad0117950507e16..1be21703bf14c2ea0a7971ec00e73d5df5545071 100644 (file)
@@ -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)