[PATCH BlueZ 1/1] Free ALSA seq resources in midi_device_remove()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sometimes, on connection error, this gets called and frees the device
when midi_disconnect() was not called which would leave ALSA sequencer
objects leaking.
---
 profiles/midi/midi.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/profiles/midi/midi.c b/profiles/midi/midi.c
index 737d1b5f6..f644d47e9 100644
--- a/profiles/midi/midi.c
+++ b/profiles/midi/midi.c
@@ -255,6 +255,16 @@ 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);
+		midi->seq_handle = NULL;
+	}
+
 	btd_device_unref(midi->dev);
 	g_free(midi);
 }
-- 
2.25.1




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux