qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v14 05/19] qmp-input: Clean up stack handling


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH v14 05/19] qmp-input: Clean up stack handling
Date: Wed, 13 Apr 2016 10:40:33 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.7.1

On 04/13/2016 10:36 AM, Eric Blake wrote:

>>    static void qmp_input_pop(QmpInputVisitor *qiv, Error **errp)
>>    {
>>        assert(qiv->nb_stack > 0);
>>
>>        if (qiv->strict) {
>>            GHashTable * const top_ht = qiv->stack[qiv->nb_stack - 1].h;
>>            if (top_ht) {
>>                GHashTableIter iter;
>>                const char *key;
>>
>>                g_hash_table_iter_init(&iter, top_ht);
>>                if (g_hash_table_iter_next(&iter, (void **)&key, NULL)) {
>>                    error_setg(errp, QERR_QMP_EXTRA_MEMBER, key);
>>
>> This looks wrong.  If we have more than one extra members, the second
>> call error_setg() will fail an assertion in error_setv(), unless errp is
>> null.
> 
> Whoops - looks like f96493b1 is broken for missing a 'break' statement.
>  I'll send that as a separate for-2.6 cleanup that we should pull sooner
> rather than later.

Scratch that, there's no error.  The outer statement is an 'if', not a
'for', so there's nothing to break out of.  The error gets set at most
once, regardless of whether there are additional unvisited members.

-- 
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

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