Proper management of controller ACL buffers.
Reclaim all the unacknowledged controller ACL buffers associated
with a L2CAP link when L2CAP control block is released.
Bug:8589069
Change-Id: Icef1646041e73280a13dedc7a45564d032c59712
diff --git a/stack/l2cap/l2c_link.c b/stack/l2cap/l2c_link.c
index 4bb2be7..1974bb2 100644
--- a/stack/l2cap/l2c_link.c
+++ b/stack/l2cap/l2c_link.c
@@ -1394,19 +1394,19 @@
(*p_lcb->p_nocp_cb)(p_lcb->remote_bd_addr);
}
-#if (BLE_INCLUDED == TRUE)
- if (p_lcb && p_lcb->is_ble_link)
- l2cb.controller_le_xmit_window += num_sent;
- else
-#endif
- {
-
- /* Maintain the total window to the controller */
- l2cb.controller_xmit_window += num_sent;
- }
-
if (p_lcb)
{
+#if (BLE_INCLUDED == TRUE)
+ if (p_lcb->is_ble_link)
+ {
+ l2cb.controller_le_xmit_window += num_sent;
+ }
+ else
+#endif
+ {
+ /* Maintain the total window to the controller */
+ l2cb.controller_xmit_window += num_sent;
+ }
/* If doing round-robin, adjust communal counts */
if (p_lcb->link_xmit_quota == 0)
{