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

Commit 8ebed2a1 authored by Subramanian Srinivasan's avatar Subramanian Srinivasan Committed by Andre Eisenbach
Browse files

Adds null check before freeing LE services list

Prevents the crash which happens when device is
disconnected during service discovery and the
services list is not yet properly allocated
memory and populated. This change frees up the
services list after discovery complete only when
it is not null.

Change-Id: I0ced14d2ee133a332fa2fd7c456267438813a600
parent adc1936f
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -1049,8 +1049,11 @@ void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
        /* used to reset cache in application */
        bta_gattc_co_cache_reset(p_clcb->p_srcb->server_bda);
    }
    if(p_clcb->p_srcb && p_clcb->p_srcb->p_srvc_list)
    {
        /* release pending attribute list buffer */
        utl_freebuf((void **)&p_clcb->p_srcb->p_srvc_list);
    }

    if (p_clcb->auto_update == BTA_GATTC_DISC_WAITING)
    {