[alsa-devel] [PATCH 4/5] ALSA: usb-audio: deallocate memory objects in error path

Takashi Sakamoto o-takashi at sakamocchi.jp
Tue Feb 21 23:59:31 CET 2017


On Feb 22 2017 07:45, Takashi Sakamoto wrote:
> On Fe 21 2017 11:32, Takashi Sakamoto wrote:
>> But it's wrong. The allocated memory objects are used for private data
>> for each control element set. I didn't care of it...
>>
>> Here, what I should fix is just for error path. I'll post revised
>> version of this patch this night.
>
> I realize that this is not concern because the code includes assignment
> deallocate function to each control element set. Thus, in error path,
> the allocated private data is going to free in below callgrach.
>
> (sound/usb/mixer_us16x08.c)
> add_new_ctl(elem)
>   kctl->private_free = freeer;
>   (sound/usb/mixer.c)
>   ->snd_usb_mixer_add_control(kctl)
>     (sound/core/control.c)
>     ->snd_ctl_add(kctl)
>       ->snd_ctl_free_one(kctl)
>         (in error path)
>         ->kcontrol->private_free(kctl);
>         (sound/usb/mixer_us16x08.c)
>         = freeer()

Oops. On the other hand, the private data for unregistered control 
element set is not deallocated automatically in error path of the other 
control element set. It should be fixed...


Regards

Takashi Sakamoto


More information about the Alsa-devel mailing list