Fix a potential memory leak

This commit is contained in:
Petri Lehtinen 2012-01-24 20:35:59 +02:00
parent f471e63bb3
commit 5eb2c442a9

View File

@ -124,10 +124,10 @@ int json_object_set_new_nocheck(json_t *json, const char *key, json_t *value)
json_object_t *object;
object_key_t *k;
if(!key || !value)
if(!value)
return -1;
if(!json_is_object(json) || json == value)
if(!key || !json_is_object(json) || json == value)
{
json_decref(value);
return -1;