[alsa-devel] [PATCH 2/4] src/pcm/pcm_mmap.c: add missing free
Takashi Iwai
tiwai at suse.de
Thu Sep 22 14:11:51 CEST 2011
At Thu, 22 Sep 2011 13:59:31 +0200 (CEST),
Julia Lawall wrote:
>
> From: Julia Lawall <julia at diku.dk>
>
> The mmap_channels and running_areas fields are allocated using calloc, but
> are not freed on an error path.
>
> Signed-off-by: Julia Lawall <julia at diku.dk>
> Signed-off-by: Suman Saha <sumsaha at gmail.com>
Thanks for a quick update.
Applied now.
Takashi
>
> ---
> Compile-tested only.
>
> src/pcm/pcm_mmap.c | 7 ++++++-
> 1 file changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c
> index 4621fe6..6b44050 100644
> --- a/src/pcm/pcm_mmap.c
> +++ b/src/pcm/pcm_mmap.c
> @@ -320,8 +320,13 @@ int snd_pcm_mmap(snd_pcm_t *pcm)
> snd_pcm_channel_info_t *i = &pcm->mmap_channels[c];
> i->channel = c;
> err = snd_pcm_channel_info(pcm, i);
> - if (err < 0)
> + if (err < 0) {
> + free(pcm->mmap_channels);
> + free(pcm->running_areas);
> + pcm->mmap_channels = NULL;
> + pcm->running_areas = NULL;
> return err;
> + }
> }
> for (c = 0; c < pcm->channels; ++c) {
> snd_pcm_channel_info_t *i = &pcm->mmap_channels[c];
>
More information about the Alsa-devel
mailing list