qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v3 07/12] qtest: Add a new helper qmp_cmd() and friends
Date: Mon, 31 Jul 2017 13:56:06 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1

On 07/31/2017 07:34 AM, Eric Blake wrote:
> On 07/31/2017 03:16 AM, Markus Armbruster wrote:
> 
>>>>> qtest_qmp(s, "%p", QOBJECT(dict)) takes ownership of dict?
>>>>
> 
>>> So given the clean bill of health from valgrind, we definitely DO turn
>>> over responsibility for freeing on object to its new wrapper, once it is
>>> passed through %p.  Documentation could be improved to make that clear.
>>>
>>> Eww, what happens if qobject_from_jsonf() can fail halfway through?

Hmm. What if we assert that qobject_from_jsonf() can never fail halfway
through?  Given my research on the other thread, gcc -Wformat will NOT
flag "['%s', %p]",str,obj as a mismatch, although our current code will
try to associate %p with str and probably die horribly when
dereferencing char* as QObject* (and if it does NOT die, we don't even
know that 'obj' was passed as a parameter).  Since the primary usage of
qobject_from_jsonf() is the testsuite, an assertion failure (forcing all
clients to use the interface correctly) is probably simpler than even
trying to have to worry about cleanup after partial failure (regardless
of whether we like the 'none' or 'all' approach).


-- 
Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]