From 89dad8959b7903b1ab3653d11b3bd4335c44015e Mon Sep 17 00:00:00 2001 From: Corey Farrell Date: Tue, 14 Nov 2017 22:44:48 -0500 Subject: [PATCH] json_object_iter_set_new: Fix error branch leak. This function needs to release a reference to value if the other arguments are invalid. Issue #135 --- src/value.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/value.c b/src/value.c index 86fda0a..94869f4 100644 --- a/src/value.c +++ b/src/value.c @@ -258,7 +258,10 @@ json_t *json_object_iter_value(void *iter) int json_object_iter_set_new(json_t *json, void *iter, json_t *value) { if(!json_is_object(json) || !iter || !value) + { + json_decref(value); return -1; + } hashtable_iter_set(iter, value); return 0;