Skip to content

Commit

Permalink
Merge branch 'bugfix/blufi_notify' into 'master'
Browse files Browse the repository at this point in the history
BluFi : Fixed hdr getting free twice

Closes IDFGH-9378

See merge request espressif/esp-idf!22416
  • Loading branch information
wmy-espressif committed Feb 21, 2023
2 parents 66cda02 + 14aa55b commit 998711b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -385,8 +385,6 @@ void esp_blufi_send_encap(void *arg)
retry:
if (blufi_env.is_connected == false) {
BTC_TRACE_WARNING("%s ble connection is broken\n", __func__);
osi_free(hdr);
hdr = NULL;
return;
}
if (esp_ble_get_cur_sendable_packets_num(BTC_GATT_GET_CONN_ID(blufi_env.conn_id)) > 0) {
Expand Down
Expand Up @@ -431,9 +431,15 @@ void esp_blufi_send_notify(void *arg)
struct pkt_info *pkts = (struct pkt_info *) arg;
struct os_mbuf *om;
om = ble_hs_mbuf_from_flat(pkts->pkt, pkts->pkt_len);
if (om == NULL) {
ESP_LOGE(TAG, "Error in allocating memory");
return;
}
int rc = 0;
rc = ble_gatts_notify_custom(blufi_env.conn_id, gatt_values[1].val_handle, om);
assert(rc == 0);
if (rc != 0) {
ESP_LOGE(TAG, "Error in sending notification");
}
}

void esp_blufi_disconnect(void)
Expand All @@ -448,8 +454,6 @@ void esp_blufi_send_encap(void *arg)
struct blufi_hdr *hdr = (struct blufi_hdr *)arg;
if (blufi_env.is_connected == false) {
BTC_TRACE_WARNING("%s ble connection is broken\n", __func__);
osi_free(hdr);
hdr = NULL;
return;
}
btc_blufi_send_notify((uint8_t *)hdr,
Expand Down

0 comments on commit 998711b

Please sign in to comment.