Diff between 8d502bb4f8cf3b9b7300c5195ce5a72c5bc0fd7d and ee88dd213b53e05854c2d8b15c3d41001a262940

Changed Files

File Additions Deletions Status
profiles/midi/midi.c +9 -0 modified

Full Patch

diff --git a/profiles/midi/midi.c b/profiles/midi/midi.c
index 737d1b5..40064df 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);
 }