From: Petri Lehtinen Date: Tue, 24 Jan 2012 18:35:59 +0000 (+0200) Subject: Fix a potential memory leak X-Git-Tag: v2.4-moonshot~1^2~46 X-Git-Url: http://www.project-moonshot.org/gitweb/?p=jansson.git;a=commitdiff_plain;h=5eb2c442a9f403f36d70b0c0e6efddf41adb056c Fix a potential memory leak --- diff --git a/src/value.c b/src/value.c index 5ef4138..e0e21cb 100644 --- a/src/value.c +++ b/src/value.c @@ -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;