summaryrefslogtreecommitdiff
path: root/misc/ifstat.c
diff options
context:
space:
mode:
authorPhil Sutter <phil@nwl.cc>2017-08-17 19:09:29 +0200
committerStephen Hemminger <stephen@networkplumber.org>2017-08-18 09:39:52 -0700
commitb530cef0e3bbd27510e19f5f720a7ec94f3fa723 (patch)
tree5bdc702c5438f517e0bde98bfd11e73e7f429c02 /misc/ifstat.c
parent35f6adefb8f9d56437f5455ac8c0c3cc329e3317 (diff)
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 <phil@nwl.cc>
Diffstat (limited to 'misc/ifstat.c')
-rw-r--r--misc/ifstat.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/misc/ifstat.c b/misc/ifstat.c
index 8fa35426..1be21703 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)