RFCOMM socket : free connection info before sending callback
[Problem] Application crash happens when
bluetooth_rfcomm_remove_socket() is called in socket disconnect callback.
[Cause & Measure] Connection information structure is freed by
bluetooth_rfcomm_remove_socket(). But after returning back from
callback, already freed structure is accessed. It causes crash.
Before sending disconnection event, free related structure first. So
that, application can use bluetooth_rfcomm_remove_socket() in
disconnection callback without crash.
[Checking Method] Call bluetooth_rfcomm_remove_socket() in server
socket's disconnection callback.
(gdb) f 0
128 conn = l->data;
(gdb) p *info
$1 = {object_id =
2874763544,
path = 0xf6ecb840, id =
1802724708,
uuid = 0x2e706f74 <error: Cannot access memory at address 0x2e706f74>, rfcomm_conns = 0x73754244, disconnect_idle_id =
1701013760}
Change-Id: I1a3436979bb1fbb3ebfa4890157f2b4868de23fd