mirror of
https://github.com/akheron/jansson.git
synced 2025-04-07 06:25:02 +00:00
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:
parent
9a1d9c88fc
commit
89dad8959b
1 changed files with 3 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Reference in a new issue