src/pcm/pcm_mmap.c: add missing free

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@diku.dk>
Signed-off-by: Suman Saha <sumsaha@gmail.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Julia Lawall 2011-09-22 13:59:31 +02:00 committed by Takashi Iwai
parent c36f8c87ff
commit fef6e6fd58

View file

@ -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];