[alsa-devel] [PATCH v6 10/15] ASoC: hdac_hdmi: Fix possible memory leak in hw_params

Mark Brown broonie at kernel.org
Mon Feb 15 21:57:26 CET 2016


On Fri, Feb 12, 2016 at 07:46:10AM +0530, Subhransu S. Prusty wrote:
> It's possible for hw_params to be called two times. So add NULL
> check to prevent memory leak.

Another fix?

> -	dd = kzalloc(sizeof(*dd), GFP_KERNEL);
> -	if (!dd)
> -		return -ENOMEM;
> +	dd = (struct hdac_ext_dma_params *)
> +		snd_soc_dai_get_dma_data(dai, substream);

If you need to cast away from void * that suggests a problem and it'd
look a lot neater too.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20160215/6e46c6d7/attachment-0001.sig>


More information about the Alsa-devel mailing list