[alsa-devel] ASoC: atmel-pcm-dma: Leaking memory in atmel_pcm_hw_params

Lars-Peter Clausen lars at metafoo.de
Sun Mar 17 15:39:58 CET 2013


Hi,

The dmaengine based pcm driver for atmel calls snd_dmaengine_pcm_open from
it's hw_params callback. There is nothing preventing an application calling
hw_params more than once. snd_dmaengine_pcm_open allocates a new prtd struct
each time it gets called. So in case hw_params is called multiple times we
leak memory here.

Is there any specific reason why snd_dmaengine_pcm_open() needs to be called
from the hw_params callback and why it can't be called from the open
callback? The filter function depends on the data returned by
snd_soc_dai_get_dma_data(), but as far as I can see the DAI driver calls
snd_soc_dai_set_dma_data() from its startup() callback, so the data is
available in the PCM drivers open callback.

- Lars


More information about the Alsa-devel mailing list