aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStefan Weil <sw@weilnetz.de>2012-09-01 09:30:39 +0200
committerLuiz Capitulino <lcapitulino@redhat.com>2012-09-05 15:48:57 -0300
commit227ccf6bff234c29974c2c18ecd3a29e6b965e3d (patch)
treed03953d22251ac5cda2cd9bc01088e95238ffb09 /scripts
parente4c8f004c55d9da3eae3e14df740238bf805b5d6 (diff)
qapi: Fix potential NULL pointer segfault
Report from smatch: qapi-visit.c:1640 visit_type_BlockdevAction(8) error: we previously assumed 'obj' could be null (see line 1639) qapi-visit.c:2432 visit_type_NetClientOptions(8) error: we previously assumed 'obj' could be null (see line 2431) Signed-off-by: Stefan Weil <sw@weilnetz.de> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'scripts')
-rw-r--r--scripts/qapi-visit.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py
index cbec24da16..e2093e8947 100644
--- a/scripts/qapi-visit.py
+++ b/scripts/qapi-visit.py
@@ -157,7 +157,7 @@ void visit_type_%(name)s(Visitor *m, %(name)s ** obj, const char *name, Error **
if (!error_is_set(errp)) {
visit_start_struct(m, (void **)obj, "%(name)s", name, sizeof(%(name)s), &err);
if (!err) {
- if (!obj || *obj) {
+ if (obj && *obj) {
visit_type_%(name)sKind(m, &(*obj)->kind, "type", &err);
if (!err) {
switch ((*obj)->kind) {