[PATCH] Freeing EDID_block attached to nowhere
Matt Turner
mattst88 at gmail.com
Sun Aug 1 17:14:47 PDT 2010
On Wed, Jul 28, 2010 at 1:34 AM, Masatake YAMATO <yamato at redhat.com> wrote:
> Thank you for reviwing. After some thinking, I think we need destructor for
> xf86MonPtr object like MonPtrFree(xf86MonPtr * mon);
> I guess you are working on this issue:-)
>
> If not, I'll provide a patch.
I spotted something different than this, so please provide a patch. :)
> Masatake YAMATO
>
>
>> On Tue, Jul 27, 2010 at 3:56 AM, Masatake YAMATO <yamato at redhat.com> wrote:
>>> EDID_block is allocated dynamically and attached to xf86MonPtr object in
>>> the function where the object is initialized.
>>> When the initilization fails, EDID_block should be freed.
>>>
>>> Signed-off-by: Masatake YAMATO <yamato at redhat.com>
>>> ---
>>> hw/xfree86/ddc/ddc.c | 4 ++++
>>> 1 files changed, 4 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/hw/xfree86/ddc/ddc.c b/hw/xfree86/ddc/ddc.c
>>> index 7379e95..873c674 100644
>>> --- a/hw/xfree86/ddc/ddc.c
>>> +++ b/hw/xfree86/ddc/ddc.c
>>> @@ -262,6 +262,8 @@ xf86DoEDID_DDC1(
>>>
>>> if (EDID_block){
>>> tmp = xf86InterpretEDID(scrnIndex,EDID_block);
>>> + if (!tmp)
>>> + free(EDID_block);
>>> }
>>> #ifdef DEBUG
>>> else ErrorF("No EDID block returned\n");
>>> @@ -423,6 +425,8 @@ xf86DoEEDID(int scrnIndex, I2CBusPtr pBus, Bool complete)
>>> }
>>>
>>> tmp = xf86InterpretEEDID(scrnIndex, EDID_block);
>>> + if (!tmp)
>>> + free(EDID_block);
>>> }
>>>
>>> if (tmp && complete)
>>> --
>>> 1.6.2.5
>>>
>>> _______________________________________________
>>> xorg-devel at lists.x.org: X.Org development
>>> Archives: http://lists.x.org/archives/xorg-devel
>>> Info: http://lists.x.org/mailman/listinfo/xorg-devel
>>>
>>
>> Looks good.
>>
>> Reviewed-by: Matt Turner <mattst88 at gmail.com>
>>
>> I think after reviewing your patch, I found another leak. Patch in progress.
More information about the xorg-devel
mailing list