From: Eric Blake <ebl...@redhat.com> 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.lur...@gmail.com> Signed-off-by: Eric Blake <ebl...@redhat.com> Message-Id: <1444861825-19256-1-git-send-email-ebl...@redhat.com> [Commit message tweaked to say 'help' instead of '?'] Signed-off-by: Markus Armbruster <arm...@redhat.com> --- scripts/qapi-visit.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/scripts/qapi-visit.py b/scripts/qapi-visit.py index 4f97781..d7f51ee 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); -- 2.4.3