mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2026-05-31 21:38:37 -04:00
fix memory leak in snd_pcm_set_chmap
This commit is contained in:
parent
1d7a131f78
commit
41b2cecedc
1 changed files with 6 additions and 3 deletions
|
|
@ -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)
|
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);
|
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;
|
return 0;
|
||||||
|
}
|
||||||
|
if (oldmap)
|
||||||
|
snd_pcm_free_chmaps(oldmap);
|
||||||
if (!pcm->ops->set_chmap)
|
if (!pcm->ops->set_chmap)
|
||||||
return -ENXIO;
|
return -ENXIO;
|
||||||
return pcm->ops->set_chmap(pcm, map);
|
return pcm->ops->set_chmap(pcm, map);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue