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
This commit is contained in:
Corey Farrell 2017-11-14 22:44:48 -05:00
parent 9a1d9c88fc
commit 89dad8959b

View File

@ -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;