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
/* used to reset cache in application */
bta_gattc_co_cache_reset(p_clcb->p_srcb->server_bda);
}
- /* release pending attribute list buffer */
- utl_freebuf((void **)&p_clcb->p_srcb->p_srvc_list);
+ 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)
{