fix memory leak in snd_pcm_set_chmap

This commit is contained in:
Conrad Jones 2019-09-15 12:30:06 -07:00
parent 1d7a131f78
commit 41b2cecedc

View file

@ -8100,9 +8100,12 @@ snd_pcm_chmap_t *snd_pcm_get_chmap(snd_pcm_t *pcm)
int snd_pcm_set_chmap(snd_pcm_t *pcm, const snd_pcm_chmap_t *map)
{
const snd_pcm_chmap_t *oldmap = snd_pcm_get_chmap(pcm);
if (oldmap && chmap_equal(oldmap, map))
if (oldmap && chmap_equal(oldmap, map)) {
snd_pcm_free_chmaps(oldmap);
return 0;
}
if (oldmap)
snd_pcm_free_chmaps(oldmap);
if (!pcm->ops->set_chmap)
return -ENXIO;
return pcm->ops->set_chmap(pcm, map);