On 09/11/2015 01:18 PM, Markus Armbruster wrote:
> Before commit 1d10b44, it crashed.  Since then, it returns NULL, with
> a FIXME comment.  The FIXME is valid: code that assumes QObject *
> can't be null exists.  I'm not aware of a way to feed this problematic
> return value to code that actually chokes on null in the current code,
> but the next few commits will create one.
> 
> Commit 481b002 solved a very similar problem by introducing a special
> null QObject.  Use it here, and drop the FIXME.
> 
> Update the test accordingly.
> 
> Signed-off-by: Markus Armbruster <arm...@redhat.com>
> ---
>  qapi/qmp-output-visitor.c       | 3 +--
>  tests/test-qmp-output-visitor.c | 2 +-
>  2 files changed, 2 insertions(+), 3 deletions(-)
> 

> +++ b/tests/test-qmp-output-visitor.c
> @@ -485,7 +485,7 @@ static void test_visitor_out_empty(TestOutputVisitorData 
> *data,
>      QObject *arg;
>  
>      arg = qmp_output_get_qobject(data->qov);
> -    g_assert(!arg);
> +    g_assert(qobject_type(arg) == QTYPE_QNULL);
>  }

Missing
 qobject_decref(arg);

Ultimately, the global qnull_ starts life with refcnt 1, and after this
test should be back to 1.  But it is coming back as 3, so even with a
qobject_decref, that would get it back down to 2.  So we are leaking a
reference to qnull somewhere.

I'm still investigating, and may be able to find the patch

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to