On 10/14/2015 10:01 AM, Marc-André Lureau wrote: > Hi, > > This patch introduces a regression: > > $ x86_64-softmmu/qemu-system-x86_64 -netdev ? > > Program received signal SIGSEGV, Segmentation fault. > 0x0000555555a0bc0f in visit_type_NetClientOptions (v=0x5555564e19e0, > obj=0x555556510438, name=0x555555af7041 "opts", errp=0x7fffffffd450) > at qapi-visit.c:6906 > 6906 visit_end_union(v, !!(*obj)->data, &err); > (gdb) print *obj > $1 = (NetClientOptions *) 0x0 visit_end_union() is pointless (it is a no-op). I plan on properly deleting visit_begin_union/visit_end_union later in my series. But in the meantime, I see the source of the problem: >> @@ -264,16 +264,18 @@ void visit_type_%(c_name)s(Visitor *v, %(c_name)s **obj, const char *name, Error >> if (err) { >> goto out; >> } >> - if (*obj) { >> + if (!*obj) { >> + goto out_obj; >> + } >> ''', >> c_name=c_name(name), name=name) >> ret += mcgen(''' >> - default: >> - abort(); >> - } >> -out_obj: >> - error_propagate(errp, err); >> - err = NULL; >> - visit_end_union(v, !!(*obj)->data, &err); >> - error_propagate(errp, err); >> - err = NULL; >> + default: >> + abort(); >> } >> +out_obj: >> + error_propagate(errp, err); >> + err = NULL; >> + visit_end_union(v, !!(*obj)->data, &err); The call to visit_end_union() used to be conditional on whether *obj was non-NULL. So I'll post the quick and obvious fix. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org