Do not abort in snd_xxx_close() functions

Remove several memory leaks by not aborting prematurely from a
snd_xxx_close() function when some operation fails.
This can happen when a USB device was unplugged.
This commit is contained in:
Clemens Ladisch 2006-02-27 09:54:57 +00:00
parent f9c7321670
commit 45850439b3
11 changed files with 33 additions and 33 deletions

View file

@ -668,13 +668,13 @@ snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm)
*/
int snd_pcm_close(snd_pcm_t *pcm)
{
int err;
int res = 0, err;
assert(pcm);
if (pcm->setup && !pcm->donot_close) {
snd_pcm_drop(pcm);
err = snd_pcm_hw_free(pcm);
if (err < 0)
return err;
res = err;
}
if (pcm->mmap_channels)
snd_pcm_munmap(pcm);
@ -684,8 +684,11 @@ int snd_pcm_close(snd_pcm_t *pcm)
}
err = pcm->ops->close(pcm->op_arg);
if (err < 0)
return err;
return snd_pcm_free(pcm);
res = err;
err = snd_pcm_free(pcm);
if (err < 0)
res = err;
return res;
}
/**