qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Eric Blake <eblake@redhat.com>
To: "Marc-André Lureau" <marcandre.lureau@redhat.com>, qemu-devel@nongnu.org
Cc: armbru@redhat.com, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qmp: fix object-add assert() without props
Date: Wed, 21 Sep 2016 14:53:49 -0500	[thread overview]
Message-ID: <d0919d8a-b99a-0a1f-d868-5fed66a7a830@redhat.com> (raw)
In-Reply-To: <20160921194126.10223-1-marcandre.lureau@redhat.com>

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

On 09/21/2016 02:41 PM, Marc-André Lureau wrote:
> Since commit ad739706bbadee49, user_creatable_add_type() expects to be
> given a qdict. However, if object-add is called without props, you reach
> the assert: "qemu/qom/object_interfaces.c:115: user_creatable_add_type:
> Assertion `qdict' failed.", because the qdict isn't created in this
> case (it's optional).
> 
> Furthermore, qmp_input_visitor_new() is not meant to be called without a
> dict, and a further commit will assert in this situation.
> 
> If none given, create an empty qdict in qmp to avoid the
> user_creatable_add_type() assert(qdict).
> 
> Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
> ---
>  qmp.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 

>      if (obj) {
>          object_unref(obj);
>      }
> +    if (!props) {
> +        qobject_decref(QOBJECT(pdict));

This can be written:

QDECREF(pdict);

With that simplification,
Reviewed-by: Eric Blake <eblake@redhat.com>

-- 
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-21 19:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-21 19:41 [Qemu-devel] [PATCH] qmp: fix object-add assert() without props Marc-André Lureau
2016-09-21 19:53 ` Eric Blake [this message]
2016-09-21 20:05 ` Paolo Bonzini
2016-09-22  8:03 ` Daniel P. Berrange
2016-09-22  9:42 ` Markus Armbruster

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=d0919d8a-b99a-0a1f-d868-5fed66a7a830@redhat.com \
    --to=eblake@redhat.com \
    --cc=armbru@redhat.com \
    --cc=marcandre.lureau@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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).