From 7128f74fe88984aeeabf5a9953471ad929669a0e Mon Sep 17 00:00:00 2001
From: Chris Manton <cmanton@google.com>
Date: Sun, 25 Oct 2020 13:25:18 -0700
Subject: [PATCH] Properly reset tL2C_CCB::ecoc

Bug: 171657571
Tag: #refactor
Test: act.py -tc BleCocTest
Change-Id: I491a7cba9b28dcc4d02d7de4463a3512e8fce719
---
 system/stack/l2cap/l2c_int.h    | 2 +-
 system/stack/l2cap/l2c_utils.cc | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/system/stack/l2cap/l2c_int.h b/system/stack/l2cap/l2c_int.h
index e1c06817fc7..967ab01193c 100644
--- a/system/stack/l2cap/l2c_int.h
+++ b/system/stack/l2cap/l2c_int.h
@@ -306,7 +306,7 @@ typedef struct t_l2c_ccb {
   uint16_t remote_credit_count;
 
   /* used to indicate that ECOC is used */
-  bool ecoc;
+  bool ecoc{false};
   bool reconfig_started;
 } tL2C_CCB;
 
diff --git a/system/stack/l2cap/l2c_utils.cc b/system/stack/l2cap/l2c_utils.cc
index 31cbde3804d..b7b2bbccb38 100644
--- a/system/stack/l2cap/l2c_utils.cc
+++ b/system/stack/l2cap/l2c_utils.cc
@@ -1452,6 +1452,7 @@ tL2C_CCB* l2cu_allocate_ccb(tL2C_LCB* p_lcb, uint16_t cid) {
   p_ccb->rx_data_rate = L2CAP_CHNL_DATA_RATE_LOW;
 
   p_ccb->is_flushable = false;
+  p_ccb->ecoc = false;
 
   alarm_free(p_ccb->l2c_ccb_timer);
   p_ccb->l2c_ccb_timer = alarm_new("l2c.l2c_ccb_timer");
-- 
GitLab