mirror of
https://github.com/bluekitchen/btstack.git
synced 2025-02-26 00:40:38 +00:00
avoid read after free on disconnect
This commit is contained in:
parent
c523d53df2
commit
bb82004450
@ -1367,10 +1367,12 @@ static void event_handler(uint8_t *packet, int size){
|
||||
hci_connection_t * conn = hci_connection_for_handle(handle);
|
||||
if (conn) {
|
||||
uint8_t status = conn->bonding_status;
|
||||
uint16_t flags = conn->bonding_flags;
|
||||
bd_addr_t bd_address;
|
||||
memcpy(&bd_address, conn->address, 6);
|
||||
hci_shutdown_connection(conn);
|
||||
if (conn->bonding_flags & BONDING_EMIT_COMPLETE_ON_DISCONNECT){
|
||||
// connection struct is gone, don't access anymore
|
||||
if (flags & BONDING_EMIT_COMPLETE_ON_DISCONNECT){
|
||||
hci_emit_dedicated_bonding_result(bd_address, status);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user