Commit 149474c9 authored by Stefan Weil's avatar Stefan Weil Committed by Luiz Capitulino
Browse files

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: default avatarStefan Weil <sw@weilnetz.de>
Signed-off-by: default avatarLuiz Capitulino <lcapitulino@redhat.com>
parent 227ccf6b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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)   \