OSDN Git Service

Revert "Avoid double memory free and crash during LE discovery or disconnect"
authorIan Pedowitz <ijpedowitz@google.com>
Fri, 29 Jan 2016 04:36:30 +0000 (04:36 +0000)
committerIan Pedowitz <ijpedowitz@google.com>
Fri, 29 Jan 2016 04:53:32 +0000 (20:53 -0800)
This reverts commit 12091a323ef84cad10d91fcf6588a6657e591ee0.

(cherry picked from commit 3a4082d7af5c5941769c700d774022a9b982d45c)

Change-Id: I2bc9969a7bd5d434b68ca05a4899a7f52ffb4f3e

bta/gatt/bta_gattc_act.c
bta/gatt/bta_gattc_utils.c

index d62f8b6..a9b9cd1 100644 (file)
@@ -1064,10 +1064,8 @@ void bta_gattc_disc_cmpl(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
     else if (p_q_cmd != NULL)
     {
         p_clcb->p_q_cmd = NULL;
-        /* execute pending operation of link block still present */
-        if (l2cu_find_lcb_by_bd_addr(p_clcb->p_srcb->server_bda, BT_TRANSPORT_LE) != NULL) {
-            bta_gattc_sm_execute(p_clcb, p_q_cmd->hdr.event, p_q_cmd);
-        }
+
+        bta_gattc_sm_execute(p_clcb, p_q_cmd->hdr.event, p_q_cmd);
         /* if the command executed requeued the cmd, we don't
          * want to free the underlying buffer that's being
          * referenced by p_clcb->p_q_cmd
index a8c4ac3..539d2a7 100644 (file)
@@ -440,15 +440,17 @@ tBTA_GATTC_SERV * bta_gattc_srcb_alloc(BD_ADDR bda)
 BOOLEAN bta_gattc_enqueue(tBTA_GATTC_CLCB *p_clcb, tBTA_GATTC_DATA *p_data)
 {
 
-    if (p_clcb->p_q_cmd == NULL)
-    {
-        p_clcb->p_q_cmd = p_data;
-        return TRUE;
-    }
+ if (p_clcb->p_q_cmd == NULL)
+ {
+     p_clcb->p_q_cmd = p_data;
+ }
+ else
+ {
+     APPL_TRACE_ERROR("already has a pending command!!");
+     /* skip the callback now. ----- need to send callback ? */
+ }
+ return (p_clcb->p_q_cmd != NULL) ? TRUE : FALSE;
 
-    APPL_TRACE_ERROR ("%s: already has a pending command!!", __func__);
-    /* skip the callback now. ----- need to send callback ? */
-    return FALSE;
 }
 
 /*******************************************************************************