Blame SOURCES/0024-json-Fix-memleak-in-dup_stmt_json.patch
|
|
34625f |
From 5b386b65d61c0f2831ef31a3674225dc21f9e1ff Mon Sep 17 00:00:00 2001
|
|
|
34625f |
From: Phil Sutter <phil@nwl.cc>
|
|
|
34625f |
Date: Fri, 12 Oct 2018 17:50:15 +0200
|
|
|
34625f |
Subject: [PATCH] json: Fix memleak in dup_stmt_json()
|
|
|
34625f |
|
|
|
34625f |
The variable 'root' is always assigned to after initialization, so there
|
|
|
34625f |
is no point in initializing it upon declaration.
|
|
|
34625f |
|
|
|
34625f |
Fixes: e70354f53e9f6 ("libnftables: Implement JSON output support")
|
|
|
34625f |
Signed-off-by: Phil Sutter <phil@nwl.cc>
|
|
|
34625f |
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
|
|
|
34625f |
(cherry picked from commit 27d8946db90b79762a36e66647bb8d8fc4c17ce9)
|
|
|
34625f |
Signed-off-by: Phil Sutter <psutter@redhat.com>
|
|
|
34625f |
---
|
|
|
34625f |
src/json.c | 2 +-
|
|
|
34625f |
1 file changed, 1 insertion(+), 1 deletion(-)
|
|
|
34625f |
|
|
|
34625f |
diff --git a/src/json.c b/src/json.c
|
|
|
34625f |
index eeba90e266f75..66b02a934a24b 100644
|
|
|
34625f |
--- a/src/json.c
|
|
|
34625f |
+++ b/src/json.c
|
|
|
34625f |
@@ -1030,7 +1030,7 @@ json_t *notrack_stmt_json(const struct stmt *stmt, struct output_ctx *octx)
|
|
|
34625f |
|
|
|
34625f |
json_t *dup_stmt_json(const struct stmt *stmt, struct output_ctx *octx)
|
|
|
34625f |
{
|
|
|
34625f |
- json_t *root = json_object();
|
|
|
34625f |
+ json_t *root;
|
|
|
34625f |
|
|
|
34625f |
if (stmt->dup.to) {
|
|
|
34625f |
root = json_pack("{s:o}", "addr", expr_print_json(stmt->dup.to, octx));
|
|
|
34625f |
--
|
|
|
34625f |
2.19.0
|
|
|
34625f |
|