mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-05 13:30:00 -05: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
|
|
@ -48,15 +48,17 @@ typedef struct {
|
|||
static int snd_rawmidi_hw_close(snd_rawmidi_t *rmidi)
|
||||
{
|
||||
snd_rawmidi_hw_t *hw = rmidi->private_data;
|
||||
int err = 0;
|
||||
|
||||
hw->open--;
|
||||
if (hw->open)
|
||||
return 0;
|
||||
if (close(hw->fd)) {
|
||||
err = -errno;
|
||||
SYSERR("close failed\n");
|
||||
return -errno;
|
||||
}
|
||||
free(hw);
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
static int snd_rawmidi_hw_nonblock(snd_rawmidi_t *rmidi, int nonblock)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue