Skip to content

Commit

Permalink
Bluetooth: Fix memory leak of command response buffer
Browse files Browse the repository at this point in the history
There was a missing net_buf_unref() for the response to reading the
controller static addresses.

Signed-off-by: Johan Hedberg <[email protected]>
  • Loading branch information
Johan Hedberg authored and Anas Nashif committed Oct 17, 2017
1 parent fe1f3d0 commit 328f80f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions subsys/bluetooth/host/hci_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -3731,10 +3731,12 @@ static int set_static_addr(void)
if (rp->num_addrs) {
bt_dev.id_addr.type = BT_ADDR_LE_RANDOM;
bt_addr_copy(&bt_dev.id_addr.a, &rp->a[0].bdaddr);
net_buf_unref(rsp);
goto set_addr;
} else {
BT_WARN("No static addresses stored in controller");
}

BT_WARN("No static addresses stored in controller");
net_buf_unref(rsp);
} else {
BT_WARN("Read Static Addresses command not available");
}
Expand Down

0 comments on commit 328f80f

Please sign in to comment.