All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-block@nongnu.org, armbru@redhat.com, mreitz@redhat.com,
	berrange@redhat.com, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 1/3] block: Add '-blockdev' command line option
Date: Fri, 23 Sep 2016 09:09:26 -0500	[thread overview]
Message-ID: <0f4a1ab1-3ffa-94fc-4a22-84d3bd33a54c@redhat.com> (raw)
In-Reply-To: <20160923093727.GB5436@noname.redhat.com>

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

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 #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 604 bytes --]

  reply	other threads:[~2016-09-23 14:09 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-22 15:42 [Qemu-devel] [PATCH 0/3] Add -blockdev command line option Kevin Wolf
2016-09-22 15:42 ` [Qemu-devel] [PATCH 1/3] block: Add '-blockdev' " Kevin Wolf
2016-09-22 18:45   ` Eric Blake
2016-09-23  9:37     ` Kevin Wolf
2016-09-23 14:09       ` Eric Blake [this message]
2016-09-22 15:42 ` [Qemu-devel] [PATCH 2/3] doc: Document generic -blockdev options Kevin Wolf
2016-09-22 18:56   ` Eric Blake
2016-09-22 15:42 ` [Qemu-devel] [PATCH 3/3] doc: Document driver-specific " Kevin Wolf
2016-09-22 19:02   ` Eric Blake
2016-09-23  9:46     ` Kevin Wolf
2016-09-22 17:12 ` [Qemu-devel] [PATCH 0/3] Add -blockdev command line option no-reply
2016-09-22 18:58   ` Eric Blake

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0f4a1ab1-3ffa-94fc-4a22-84d3bd33a54c@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=berrange@redhat.com \
    --cc=kwolf@redhat.com \
    --cc=mreitz@redhat.com \
    --cc=qemu-block@nongnu.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.