Blame SOURCES/0081-ifstat-Fix-memleak-in-dump_kern_db-for-json-output.patch

99be8f
From 3f74fdcd943982101775db3b4240a6f953d1198d Mon Sep 17 00:00:00 2001
99be8f
From: Andrea Claudi <aclaudi@redhat.com>
99be8f
Date: Mon, 29 Apr 2019 20:07:22 +0200
99be8f
Subject: [PATCH] ifstat: Fix memleak in dump_kern_db() for json output
99be8f
99be8f
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1465646
99be8f
Upstream Status: iproute2.git commit b530cef0e3bbd
99be8f
99be8f
commit b530cef0e3bbd27510e19f5f720a7ec94f3fa723
99be8f
Author: Phil Sutter <phil@nwl.cc>
99be8f
Date:   Thu Aug 17 19:09:29 2017 +0200
99be8f
99be8f
    ifstat: Fix memleak in dump_kern_db() for json output
99be8f
99be8f
    Looks like this was forgotten when converting to common json output
99be8f
    formatter.
99be8f
99be8f
    Fixes: fcc16c2287bf8 ("provide common json output formatter")
99be8f
    Signed-off-by: Phil Sutter <phil@nwl.cc>
99be8f
---
99be8f
 misc/ifstat.c | 8 ++++++--
99be8f
 1 file changed, 6 insertions(+), 2 deletions(-)
99be8f
99be8f
diff --git a/misc/ifstat.c b/misc/ifstat.c
99be8f
index 8fa354265a9a1..1be21703bf14c 100644
99be8f
--- a/misc/ifstat.c
99be8f
+++ b/misc/ifstat.c
99be8f
@@ -535,8 +535,12 @@ static void dump_kern_db(FILE *fp)
99be8f
 		else
99be8f
 			print_one_if(fp, n, n->val);
99be8f
 	}
99be8f
-	if (json_output)
99be8f
-		fprintf(fp, "\n} }\n");
99be8f
+	if (jw) {
99be8f
+		jsonw_end_object(jw);
99be8f
+
99be8f
+		jsonw_end_object(jw);
99be8f
+		jsonw_destroy(&jw;;
99be8f
+	}
99be8f
 }
99be8f
 
99be8f
 static void dump_incr_db(FILE *fp)
99be8f
-- 
99be8f
2.20.1
99be8f