On 09/23/2016 04:37 AM, Kevin Wolf wrote: >> >>> +static int blockdev_init_func(void *opaque, QemuOpts *opts, Error **errp) >>> +{ >>> + BlockdevOptions *options; >> >> Uninitialized... > > Oops, good catch. Thanks. >
>>> + visit_free(v); >>> + >>> + v = qapi_dealloc_visitor_new(); >>> + visit_type_BlockdevOptions(v, NULL, &options, NULL); >> > > I don't think you're right about the leak, the dealloc visitor takes > care of deallocating the top level object as well. However, it's true > that qapi_free_BlockdevOptions() already has the dealloc visitor code > internally, so instead of open-coding it here, I can replace (rather > than complement) the above code with a call to it. Indeed. In fact, I've even documented that MOST callers should NOT be using qapi_dealloc_visitor_new() directly. So you are correct that the real fix is to quit open-coding the destruction, and use the one-liner qapi_free_* in its place. -- Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature