[nft PATCH] json: Fix memleak in dup_stmt_json()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx>
---
 src/json.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/json.c b/src/json.c
index f5d97c623fb3a..1ab2d431d0a2d 100644
--- a/src/json.c
+++ b/src/json.c
@@ -1131,7 +1131,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.19.0




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux