From: Paolo Bonzini <pbonzini@redhat.com>
To: Markus Armbruster <armbru@redhat.com>
Cc: Peter Maydell <peter.maydell@linaro.org>, qemu-devel@nongnu.org
Subject: Re: [PATCH] vl: fix leak of qdict_crumple return value
Date: Thu, 8 Jul 2021 11:42:54 +0200 [thread overview]
Message-ID: <6126d8d4-38dc-d63b-b1f8-e8da62d28d28@redhat.com> (raw)
In-Reply-To: <87k0m19nw6.fsf@dusky.pond.sub.org>
On 08/07/21 11:05, Markus Armbruster wrote:
> Minimally invasive fix, but the result is a bit awkward. Possibly
> neater:
>
> if (qobject_type(crumpled) == QTYPE_QLIST) {
> error_setg(errp,
> "Lists cannot be at top level of a configuration section");
> } else {
> assert(qobject_type(crumpled) == QTYPE_QDICT);
> qemu_record_config_group(group, qobject_to(QDict, crumpled),
> false, errp);
> }
> qobject_unref(crumpled);
Even better:
switch (qobject_type(crumpled)) {
case QTYPE_QDICT:
qemu_record_config_group(group, qobject_to(QDict, crumpled), false, errp);
break;
case QTYPE_QLIST:
error_setg(errp, "Lists cannot be at top level of a configuration section");
break;
default:
g_assert_unreachable();
}
Paolo
prev parent reply other threads:[~2021-07-08 9:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-07-07 12:15 [PATCH] vl: fix leak of qdict_crumple return value Paolo Bonzini
2021-07-08 9:05 ` Markus Armbruster
2021-07-08 9:41 ` Paolo Bonzini
2021-07-08 9:42 ` Paolo Bonzini [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=6126d8d4-38dc-d63b-b1f8-e8da62d28d28@redhat.com \
--to=pbonzini@redhat.com \
--cc=armbru@redhat.com \
--cc=peter.maydell@linaro.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 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).