From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:58816) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bmnab-0006wB-Tn for qemu-devel@nongnu.org; Wed, 21 Sep 2016 15:53:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bmnaZ-00032L-92 for qemu-devel@nongnu.org; Wed, 21 Sep 2016 15:53:53 -0400 References: <20160921194126.10223-1-marcandre.lureau@redhat.com> From: Eric Blake Message-ID: Date: Wed, 21 Sep 2016 14:53:49 -0500 MIME-Version: 1.0 In-Reply-To: <20160921194126.10223-1-marcandre.lureau@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="xrfxLMsfFirwA5gSGEQ8qExXqUaCvIp00" Subject: Re: [Qemu-devel] [PATCH] qmp: fix object-add assert() without props List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , qemu-devel@nongnu.org Cc: armbru@redhat.com, qemu-stable@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --xrfxLMsfFirwA5gSGEQ8qExXqUaCvIp00 From: Eric Blake To: =?UTF-8?Q?Marc-Andr=c3=a9_Lureau?= , qemu-devel@nongnu.org Cc: armbru@redhat.com, qemu-stable@nongnu.org Message-ID: Subject: Re: [PATCH] qmp: fix object-add assert() without props References: <20160921194126.10223-1-marcandre.lureau@redhat.com> In-Reply-To: <20160921194126.10223-1-marcandre.lureau@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 09/21/2016 02:41 PM, Marc-Andr=C3=A9 Lureau wrote: > Since commit ad739706bbadee49, user_creatable_add_type() expects to be > given a qdict. However, if object-add is called without props, you reac= h > 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). >=20 > Furthermore, qmp_input_visitor_new() is not meant to be called without = a > dict, and a further commit will assert in this situation. >=20 > If none given, create an empty qdict in qmp to avoid the > user_creatable_add_type() assert(qdict). >=20 > Signed-off-by: Marc-Andr=C3=A9 Lureau > --- > qmp.c | 9 +++++++-- > 1 file changed, 7 insertions(+), 2 deletions(-) >=20 > if (obj) { > object_unref(obj); > } > + if (!props) { > + qobject_decref(QOBJECT(pdict)); This can be written: QDECREF(pdict); With that simplification, Reviewed-by: Eric Blake --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --xrfxLMsfFirwA5gSGEQ8qExXqUaCvIp00 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJX4uVNAAoJEKeha0olJ0NqrLkH+wVNQbMWjo00aDHjKtDlAJaU GeRWWYLL2djVRHW68dIcv6unW1a7euG+w+CHLvgTTP8ydI9b+Vt+7iDQ5/kf48Yj pgGt5q5jQ+uLfjZMvQ5j9cMvOSaQ9Ez81FdCVego87j6emUfB5bVXzmh2rd2iZVI fDM38MN50WWXk/Q9XoCJePcmNQIvNPqPi3BUF5J39xH7Ksro5ZaHSB1DRu9oe/iD RFMQuXMVLDbZiWt0k8X954yA+KcOKIKQ0VekQVeljyUlaz0e9fOqlDbQUPjDw4RH nCcP+RDT7JxD2d9GqJZCk5SwjhRsRff1H84/W5/YEFV5g4/SSdKWIjerY1q94r4= =eAF7 -----END PGP SIGNATURE----- --xrfxLMsfFirwA5gSGEQ8qExXqUaCvIp00--