mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
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:
parent
f9c7321670
commit
45850439b3
11 changed files with 33 additions and 33 deletions
|
|
@ -889,16 +889,15 @@ static int snd_pcm_hw_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|||
static int snd_pcm_hw_close(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private_data;
|
||||
int err;
|
||||
int err = 0;
|
||||
if (close(hw->fd)) {
|
||||
err = -errno;
|
||||
SYSMSG("close failed\n");
|
||||
return err;
|
||||
}
|
||||
snd_pcm_hw_munmap_status(pcm);
|
||||
snd_pcm_hw_munmap_control(pcm);
|
||||
free(hw);
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
static snd_pcm_sframes_t snd_pcm_hw_mmap_commit(snd_pcm_t *pcm,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue