mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-02 09:01:48 -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
|
|
@ -341,14 +341,13 @@ int snd_rawmidi_close(snd_rawmidi_t *rawmidi)
|
|||
{
|
||||
int err;
|
||||
assert(rawmidi);
|
||||
if ((err = rawmidi->ops->close(rawmidi)) < 0)
|
||||
return err;
|
||||
err = rawmidi->ops->close(rawmidi);
|
||||
if (rawmidi->name)
|
||||
free(rawmidi->name);
|
||||
if (rawmidi->dl_handle)
|
||||
snd_dlclose(rawmidi->dl_handle);
|
||||
free(rawmidi);
|
||||
return 0;
|
||||
return err;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue