aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCorey Farrell <git@cfware.com>2017-11-14 22:44:48 -0500
committerCorey Farrell <git@cfware.com>2017-12-13 14:04:07 -0500
commit89dad8959b7903b1ab3653d11b3bd4335c44015e (patch)
tree46d57d758330e8e748da03db6beb074083c8ab6c
parent9a1d9c88fce268b812453d0d23237ee805b9bc34 (diff)
downloadjansson-89dad8959b7903b1ab3653d11b3bd4335c44015e.zip
jansson-89dad8959b7903b1ab3653d11b3bd4335c44015e.tar.gz
jansson-89dad8959b7903b1ab3653d11b3bd4335c44015e.tar.bz2
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
-rw-r--r--src/value.c3
1 files changed, 3 insertions, 0 deletions
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;