Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1770bf96 authored by Lianchao Song's avatar Lianchao Song Committed by Andre Eisenbach
Browse files

Fix SIGSEGV during Hands-free client SDP

Fixes: 70367002
Change-Id: I2fd7a00551157a000b87c7bbdbc8a2c93cff21c4
parent e155d2af
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -381,7 +381,7 @@ void bta_hf_client_collision_cback(UNUSED_ATTR tBTA_SYS_CONN_STATUS status,
    /* Cancel SDP if it had been started. */
    if (client_cb->p_disc_db) {
      (void)SDP_CancelServiceSearch(client_cb->p_disc_db);
      bta_hf_client_free_db(NULL);
      osi_free_and_reset((void**)&client_cb->p_disc_db);
    }

    /* reopen registered server */
+1 −1
Original line number Diff line number Diff line
@@ -284,7 +284,7 @@ void bta_hf_client_rfc_do_close(tBTA_HF_CLIENT_DATA* p_data) {
    /* Cancel SDP if it had been started. */
    if (client_cb->p_disc_db) {
      (void)SDP_CancelServiceSearch(client_cb->p_disc_db);
      bta_hf_client_free_db(NULL);
      osi_free_and_reset((void**)&client_cb->p_disc_db);
    }
  }
}
+3 −1
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@
 ******************************************************************************/

#include <string.h>
#include <base/logging.h>

#include "bt_utils.h"
#include "bta_api.h"
@@ -331,7 +332,7 @@ void bta_hf_client_do_disc(tBTA_HF_CLIENT_CB* client_cb) {

  if (!db_inited) {
    /*free discover db */
    bta_hf_client_free_db(NULL);
    osi_free_and_reset((void**)&client_cb->p_disc_db);
    /* sent failed event */
    tBTA_HF_CLIENT_DATA msg;
    msg.hdr.layer_specific = client_cb->handle;
@@ -350,6 +351,7 @@ void bta_hf_client_do_disc(tBTA_HF_CLIENT_CB* client_cb) {
 *
 ******************************************************************************/
void bta_hf_client_free_db(tBTA_HF_CLIENT_DATA* p_data) {
  CHECK(p_data != NULL);
  tBTA_HF_CLIENT_CB* client_cb =
      bta_hf_client_find_cb_by_handle(p_data->hdr.layer_specific);
  if (client_cb == NULL) {