You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by ry...@apache.org on 2019/03/26 06:53:30 UTC

[mynewt-nimble] branch master updated: Revert "nimble/l2cap: Fix possible memory leak"

This is an automated email from the ASF dual-hosted git repository.

rymek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-nimble.git


The following commit(s) were added to refs/heads/master by this push:
     new 370305a  Revert "nimble/l2cap: Fix possible memory leak"
370305a is described below

commit 370305a086b474e68346f246543a8ce760e6b336
Author: Ɓukasz Rymanowski <lu...@codecoup.pl>
AuthorDate: Tue Mar 26 00:45:27 2019 +0100

    Revert "nimble/l2cap: Fix possible memory leak"
    
    This reverts commit cf63688ebfd8173421d54cef8dacdb85a448676e.
    
    This is not needed as ble_l2cap_prepend_hdr() will free txom when
    returning NULL
---
 nimble/host/src/ble_l2cap.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/nimble/host/src/ble_l2cap.c b/nimble/host/src/ble_l2cap.c
index 7c01ac3..a9252b8 100644
--- a/nimble/host/src/ble_l2cap.c
+++ b/nimble/host/src/ble_l2cap.c
@@ -393,15 +393,13 @@ ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
              struct os_mbuf *txom)
 {
     int rc;
-    struct os_mbuf *om;
 
-    om = ble_l2cap_prepend_hdr(txom, chan->dcid, OS_MBUF_PKTLEN(txom));
-    if (om == NULL) {
-        os_mbuf_free_chain(txom);
+    txom = ble_l2cap_prepend_hdr(txom, chan->dcid, OS_MBUF_PKTLEN(txom));
+    if (txom == NULL) {
         return BLE_HS_ENOMEM;
     }
 
-    rc = ble_hs_hci_acl_tx(conn, &om);
+    rc = ble_hs_hci_acl_tx(conn, &txom);
     switch (rc) {
     case 0:
         /* Success. */
@@ -409,7 +407,7 @@ ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
 
     case BLE_HS_EAGAIN:
         /* Controller could not accommodate full packet.  Enqueue remainder. */
-        STAILQ_INSERT_TAIL(&conn->bhc_tx_q, OS_MBUF_PKTHDR(om), omp_next);
+        STAILQ_INSERT_TAIL(&conn->bhc_tx_q, OS_MBUF_PKTHDR(txom), omp_next);
         return 0;
 
     default: