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

Commit b82e91a2 authored by Bailey Forrest's avatar Bailey Forrest Committed by android-build-merger
Browse files

Merge "btm_sec_disconnected Check if p_dev_rec is still in scope"

am: 2c9b6031

Change-Id: Iae71e17f3bcf081758d1b9ea85a81a9d43c341c0
parents 552fe3bb 2c9b6031
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -4480,6 +4480,13 @@ void btm_sec_disconnected(uint16_t handle, uint8_t reason) {
      (*btm_cb.api.p_auth_complete_callback)(p_dev_rec->bd_addr,
                                             p_dev_rec->dev_class,
                                             p_dev_rec->sec_bd_name, result);

      // |btm_cb.api.p_auth_complete_callback| may cause |p_dev_rec| to be
      // deallocated.
      p_dev_rec = btm_find_dev_by_handle(handle);
      if (!p_dev_rec) {
        return;
      }
    }
  }