diff options
author | Jacek Konieczny <jajcus@jajcus.net> | 2021-11-01 14:49:18 +0100 |
---|---|---|
committer | Luiz Augusto von Dentz <luiz.von.dentz@intel.com> | 2021-11-03 17:36:43 -0700 |
commit | ee88dd213b53e05854c2d8b15c3d41001a262940 (patch) | |
tree | be160d47bac0ea1f3573bd058e2cd74592d897b2 /profiles/midi | |
parent | 8d502bb4f8cf3b9b7300c5195ce5a72c5bc0fd7d (diff) | |
download | bluez-ee88dd213b53e05854c2d8b15c3d41001a262940.tar.gz |
midi: Free ALSA seq resources in midi_device_remove()
Sometimes, on connection error, this gets called and frees the device
when midi_disconnect() was not called which would leave ALSA sequencer
objects leaking.
Diffstat (limited to 'profiles/midi')
-rw-r--r-- | profiles/midi/midi.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/profiles/midi/midi.c b/profiles/midi/midi.c index 737d1b5f6..40064df3a 100644 --- a/profiles/midi/midi.c +++ b/profiles/midi/midi.c @@ -255,6 +255,15 @@ static void midi_device_remove(struct btd_service *service) return; } + if (midi->seq_handle) { + midi_read_free(&midi->midi_in); + midi_write_free(&midi->midi_out); + io_destroy(midi->io); + snd_seq_delete_simple_port(midi->seq_handle, midi->seq_port_id); + midi->seq_port_id = 0; + snd_seq_close(midi->seq_handle); + } + btd_device_unref(midi->dev); g_free(midi); } |