qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 1/3] block: Add '-blockdev' command line option


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH 1/3] block: Add '-blockdev' command line option
Date: Fri, 23 Sep 2016 09:09:26 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.3.0

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

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]