aboutsummaryrefslogtreecommitdiff
path: root/qobject.h
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2012-09-03 21:19:11 +0200
committerLuiz Capitulino <lcapitulino@redhat.com>2012-09-05 15:48:57 -0300
commit149474c93490e1c66f838391bd491db83136d91d (patch)
tree6ea6f647d12fe60564e40a93e3fcb2dd60d27deb /qobject.h
parent227ccf6bff234c29974c2c18ecd3a29e6b965e3d (diff)
downloadqemu-149474c93490e1c66f838391bd491db83136d91d.zip
qemu-149474c93490e1c66f838391bd491db83136d91d.tar.gz
qemu-149474c93490e1c66f838391bd491db83136d91d.tar.bz2
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 <sw@weilnetz.de> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'qobject.h')
-rw-r--r--qobject.h2
1 files changed, 1 insertions, 1 deletions
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) \