[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions |
Date: |
Thu, 30 Jul 2015 17:08:15 -0600 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.1.0 |
On 07/30/2015 09:44 AM, Markus Armbruster wrote:
>>>> which means that if we name any of the branches 'data' (that is, if
>>>> 'data' is a member of the enum discriminator), things fail to compile.
>>>> We could probably fix that by naming our dummy branch '_data'.
>>>
>>> I wonder whether member data is actually used. I'll find out.
>>
>> The dealloc visitor uses 'data' being non-null as a flag on whether to
>> deallocate the union even if the tag was invalid for some reason; or
>> more importantly, if parsing consumed the tag but then detected an error
>> while parsing the union, leaving the union branch partially allocated.
>> To avoid a leak, we have to deallocate the branch.
>>
>> But if the tag was invalid, then why did we ever allocate the union in
>> the first place, and how do we prove we are calling the correct free-ing
>> function? And if the tag is valid, why can't we just guarantee that the
>> union is 0-initialized and that deleting the branch will work through
>> the correct branch type instead of worrying about 'data'?
>
> Good questions. Someone will have to review and fix this code. Let's
> add a FIXME so we don't forget. Care to propose one?
Sure; see 12.6/47 (since that is close to several other patches adding
FIXME comments).
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library http://libvirt.org
signature.asc
Description: OpenPGP digital signature
- Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions, (continued)
Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions, Eric Blake, 2015/07/28
- Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions, Markus Armbruster, 2015/07/29
- Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions, Eric Blake, 2015/07/29
- Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions, Markus Armbruster, 2015/07/30
- Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions, Eric Blake, 2015/07/30
- Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions, Markus Armbruster, 2015/07/30
- Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions,
Eric Blake <=
Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions, Markus Armbruster, 2015/07/31
Re: [Qemu-devel] [PATCH RFC v2 07/47] qapi: Generate a nicer struct for flat unions, Markus Armbruster, 2015/07/31
[Qemu-devel] [PATCH RFC v2 01/47] qapi: Clarify docs on including the same file multiple times, Markus Armbruster, 2015/07/01
[Qemu-devel] [PATCH RFC v2 05/47] qapi: Reject -p arguments that break qapi-event.py, Markus Armbruster, 2015/07/01
[Qemu-devel] [PATCH RFC v2 10/47] qapi-visit: Fix two name arguments passed to visitors, Markus Armbruster, 2015/07/01