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