• Mike J. Chen's avatar
    Fix GKI buffer leak in GATT event handling · 90715aad
    Mike J. Chen authored
    
    
    The GATT event handler was telling the BTA dispatcher that
    it would always free the GKI msg buffers itself, but in fact
    this wasn't true.  There were some cases where the buffer is
    queued and freed later (queued in p_clcb->p_q_cmd for later
    access and freeing), but many times the event handlers
    (like bta_gattc_ci_save()) don't queue the buffer and don't
    free it, causing a GKI buffer leak.
    
    Also, prevent a double free case (not certain it happens, but
    in theory it could) if bta_gattc_sm_execute() queues a buffer
    in bta_gattc_disc_cmpl().
    
    Lastly, remove held flag since it's redundant with whether
    p_q_cmd is null or not.  Just go with one source of truth and
    not have one shadow the other.
    
    Change-Id: I1bd43919b8a2e125076e26cd6a3a08480b3e7e2d
    Signed-off-by: default avatarMike J. Chen <mjchen@google.com>
    90715aad
bta_gattc_int.h 20.1 KB