[alsa-devel] [PATCH 3/6] topology: Use generic pointer to realloc buffer for private data
Mengdong Lin
mengdong.lin at linux.intel.com
Wed May 4 03:29:33 CEST 2016
On 04/28/2016 10:30 PM, Lin, Mengdong wrote:
>> -----Original Message-----
>> From: Takashi Iwai [mailto:tiwai at suse.de]
>> Sent: Thursday, April 28, 2016 9:55 PM
>> To: Jaroslav Kysela
>> Cc: mengdong.lin at linux.intel.com; alsa-devel at alsa-project.org;
>> broonie at kernel.org; Girdwood, Liam R; Lin, Mengdong; Shah, Hardik T; Singh,
>> Guneshwor O
>> Subject: Re: [PATCH 3/6] topology: Use generic pointer to realloc buffer for
>> private data
>>
>> On Thu, 28 Apr 2016 10:48:36 +0200,
>> Jaroslav Kysela wrote:
>>>
>>> Dne 28.4.2016 v 10:41 mengdong.lin at linux.intel.com napsal(a):
>>>> priv_data_size = ref->data->size;
>>>> + elem->obj = realloc(elem->obj,
>>>> + elem->size + priv_data_size);
>>>> + if (!elem->obj)
>>>> + return -ENOMEM;
>>>
>>> This causes a memory leak when realloc fails. You should free the
>>> original pointer when realloc() fails.
>>
>> Right, and the bug (the leak) has been already present before the patch...
>>
>
> Okay, we'll fix this. Thanks for pointing out this.
>
I fixed this issue in v2 series. Would you please have a review?
Thanks again
Mengdong
More information about the Alsa-devel
mailing list