From: Stefan Weil Date: Mon, 3 Sep 2012 19:19:11 +0000 (+0200) Subject: json-parser: Fix potential NULL pointer segfault X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~3606^2~9 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=149474c93490e1c66f838391bd491db83136d91d;p=sdk%2Femulator%2Fqemu.git json-parser: Fix potential NULL pointer segfault Report from smatch: json-parser.c:474 parse_object(62) error: potential null derefence 'dict'. json-parser.c:553 parse_array(75) error: potential null derefence 'list'. Label 'out' in json-parser.c can be called with list == NULL which is passed to QDECREF. Modify QDECREF to handle a NULL argument (inline function qobject_decref already handles them, too). Signed-off-by: Stefan Weil Signed-off-by: Luiz Capitulino --- diff --git a/qobject.h b/qobject.h index d42386d..9124649 100644 --- a/qobject.h +++ b/qobject.h @@ -71,7 +71,7 @@ typedef struct QObject { /* High-level interface for qobject_decref() */ #define QDECREF(obj) \ - qobject_decref(QOBJECT(obj)) + qobject_decref(obj ? QOBJECT(obj) : NULL) /* Initialize an object to default values */ #define QOBJECT_INIT(obj, qtype_type) \