From: Anthony Liguori <anthony@codemonkey.ws>
To: Kevin Wolf <kwolf@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qdev: Free opts on failed do_device_add
Date: Fri, 19 Feb 2010 16:01:05 -0600 [thread overview]
Message-ID: <4B7F0A21.3000104@codemonkey.ws> (raw)
In-Reply-To: <1266322358-7075-1-git-send-email-kwolf@redhat.com>
On 02/16/2010 06:12 AM, Kevin Wolf wrote:
> If the device can't be created, don't leak the QemuOpts and release the id of
> the device that should have been added by the failed device_add.
>
> Signed-off-by: Kevin Wolf<kwolf@redhat.com>
>
Applied. Thanks.
Regards,
Anthony Liguori
> ---
> hw/qdev.c | 7 +++++--
> 1 files changed, 5 insertions(+), 2 deletions(-)
>
> diff --git a/hw/qdev.c b/hw/qdev.c
> index 539b5a2..d0052d4 100644
> --- a/hw/qdev.c
> +++ b/hw/qdev.c
> @@ -749,8 +749,11 @@ void do_device_add(Monitor *mon, const QDict *qdict)
>
> opts = qemu_opts_parse(&qemu_device_opts,
> qdict_get_str(qdict, "config"), "driver");
> - if (opts&& !qdev_device_help(opts))
> - qdev_device_add(opts);
> + if (opts) {
> + if (qdev_device_help(opts) || qdev_device_add(opts) == NULL) {
> + qemu_opts_del(opts);
> + }
> + }
> }
>
> void do_device_del(Monitor *mon, const QDict *qdict)
>
prev parent reply other threads:[~2010-02-19 22:01 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-16 12:12 [Qemu-devel] [PATCH] qdev: Free opts on failed do_device_add Kevin Wolf
2010-02-16 15:08 ` Gerd Hoffmann
2010-02-19 22:01 ` Anthony Liguori [this message]
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=4B7F0A21.3000104@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=kwolf@redhat.com \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).