[PATCH 1/2] xfree86: fix a memory leak in edidMakeAtom().

walter harms wharms at bfs.de
Fri Jul 12 05:23:45 PDT 2013



Am 12.07.2013 00:02, schrieb Julien Cristau:
> On Mon, Jun 17, 2013 at 12:39:20 -0400, alexdeucher at gmail.com wrote:
> 
>> From: Leo Liu <leo.liu at amd.com>
>>
>> leak happens when looping xrandr prop.
>>
>> Signed-off-by: Leo Liu <leo.liu at amd.com>
>> ---
>>  hw/xfree86/common/xf86Helper.c |    1 +
>>  1 file changed, 1 insertion(+)
>>
>> diff --git a/hw/xfree86/common/xf86Helper.c b/hw/xfree86/common/xf86Helper.c
>> index 721159d..bb17ecc 100644
>> --- a/hw/xfree86/common/xf86Helper.c
>> +++ b/hw/xfree86/common/xf86Helper.c
>> @@ -1813,6 +1813,7 @@ xf86RegisterRootWindowProperty(int ScrnIndex, Atom property, Atom type,
>>      }
>>      else {
>>          free(pNewProp->name);
>> +        free(pNewProp->data);
>>          existing = TRUE;
>>      }
>>  
> AFAICT xf86RegisterRootWindowProperty can be called with non-malloc
> 'value' (e.g. for the SeatId stuff in InitOutput, although that's only
> for serverGeneration == 1).  Is there any way to make this a little more
> obviously correct?
> 

what about a comment like:
/*
	for serverGeneration > 1 this is dynamic
	for serverGeneration == 1 this may not work
*/
        free(pNewProp->data);


re,
 wh

> Cheers,
> Julien
> _______________________________________________
> 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


More information about the xorg-devel mailing list