From d951f1c78c2131fd466abec3c800fff7a4108c65 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Mon, 1 Feb 2010 14:57:27 -0800 Subject: [PATCH] json: Fix memory leak when nesting depth is exceeded. This is probably not an important memory leak, since it is only on a rare error path, but it is best to fix it anyway. Found with valgrind. --- lib/json.c | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/json.c b/lib/json.c index 0339a368d..8fd9c3a7a 100644 --- a/lib/json.c +++ b/lib/json.c @@ -1213,6 +1213,7 @@ json_parser_push(struct json_parser *p, p->parse_state = new_state; return node; } else { + json_destroy(new_json); json_error(p, "input exceeds maximum nesting depth %d", JSON_MAX_HEIGHT); return NULL; -- 2.43.0