Sometimes, on connection error, this gets called and frees the device
when midi_disconnect() was not called which would leave ALSA sequencer
objects leaking.
Signed-off-by: Anuj Jain <anuj01.jain@samsung.com>
Signed-off-by: Ayush Garg <ayush.garg@samsung.com>
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);
}