diff options
author | Eric Blake <eblake@redhat.com> | 2015-10-14 16:30:25 -0600 |
---|---|---|
committer | Markus Armbruster <armbru@redhat.com> | 2015-10-15 08:37:11 +0200 |
commit | d08ac81a459258ce20b3184fa9325c6c1350ac9e (patch) | |
tree | 66c6c0716522439034e1914a9f76900cffc92ba2 | |
parent | c49d3411faae8ffaab8f7e5db47405a008411c10 (diff) | |
download | qemu-d08ac81a459258ce20b3184fa9325c6c1350ac9e.tar.gz qemu-d08ac81a459258ce20b3184fa9325c6c1350ac9e.tar.bz2 qemu-d08ac81a459258ce20b3184fa9325c6c1350ac9e.zip |
qapi: Fix regression with '-netdev help'
Commit e36c714e causes 'qemu -netdev help' to dump core, because the
call to visit_end_union() is no longer conditional on whether *obj was
allocated.
Reported by Marc-André Lureau <marcandre.lureau@gmail.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <1444861825-19256-1-git-send-email-eblake@redhat.com>
[Commit message tweaked to say 'help' instead of '?']
Signed-off-by: Markus Armbruster <armbru@redhat.com>
-rw-r--r-- | scripts/qapi-visit.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 4f97781348..d7f51ee250 100644 --- a/scripts/qapi-visit.py +++ b/scripts/qapi-visit.py @@ -301,7 +301,9 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error out_obj: error_propagate(errp, err); err = NULL; - visit_end_union(v, !!(*obj)->data, &err); + if (*obj) { + visit_end_union(v, !!(*obj)->data, &err); + } error_propagate(errp, err); err = NULL; visit_end_struct(v, &err); |