qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] pc: fix leak in pc_system_flash_cleanup_unused


From: Paolo Bonzini
Subject: Re: [PATCH] pc: fix leak in pc_system_flash_cleanup_unused
Date: Wed, 1 Jul 2020 16:18:37 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0

On 01/07/20 15:06, Alexander Bulekov wrote:
>> Yes; you can also add it in pc_pflash_create, because
>>
>>     /*
>>      * Since object_property_add_child added a reference to the child object,
>>      * we can drop the reference added by object_initialize(), so the child
>>      * property will own the only reference to the object.
>>      */
>>
>> (from object_initialize_childv).
> Isn't that reference used at pc_sysfw.c:104 ?
> pcms->flash[0] = pc_pflash_create(pcms, "system.flash0", "pflash0");
> 
> In this case, shouldn't we unref when
> pc_sysfw.c:126  pcms->flash[0] = NULL
> ?

object_unparent already drops a reference.  Therefore, it's okay to drop
the reference immediately after object_property_add_child (which adds a
reference) and match pc_pflash_create with just object_unparent.

Paolo




reply via email to

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