[PATCH 04/11] xi: fix memory leak in ProcXListProperties and ProcXIListProperties

Tiago Vignatti tiago.vignatti at nokia.com
Mon Mar 28 03:33:46 PDT 2011


On 03/26/2011 01:34 AM, ext Nicolas PENINGUY wrote:
> On Fri, 2011-03-25 at 20:41 +0200, Tiago Vignatti wrote:
>> diff --git a/Xi/xiproperty.c b/Xi/xiproperty.c
>> index 83ce930..b55e7f3 100644
>> --- a/Xi/xiproperty.c
>> +++ b/Xi/xiproperty.c
>> @@ -904,8 +904,8 @@ ProcXListDeviceProperties (ClientPtr client)
>>       {
>>           client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
>>           WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
>> -        free(atoms);
>>       }
>> +    free(atoms);
>>       return rc;
>>   }
>
> I think it's wrong, because if natoms equals 0, list_atoms() doesn't
> allocate anything and sets atoms to NULL.
>
>
>>
>> @@ -1148,8 +1148,8 @@ ProcXIListProperties(ClientPtr client)
>>       {
>>           client->pSwapReplyFunc = (ReplySwapPtr)Swap32Write;
>>           WriteSwappedDataToClient(client, natoms * sizeof(Atom), atoms);
>> -        free(atoms);
>>       }
>> +    free(atoms);
>>       return rc;
>>   }
>
> Same here.

good point. Thank you for the review!

        Tiago


More information about the xorg-devel mailing list