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

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

commit 69611f72f774b26020190279e2407f59e891fe1a
Author: Krzysztof Kopyściński <krzysztof.kopyscin...@codecoup.pl>
AuthorDate: Tue Feb 23 11:24:33 2021 +0100

    mesh/transport: fix unreachable os_mbuf_free_chain in bt_mesh_ctl_send
---
 nimble/host/mesh/src/transport.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/nimble/host/mesh/src/transport.c b/nimble/host/mesh/src/transport.c
index 00ccb08..f3a7c2d 100644
--- a/nimble/host/mesh/src/transport.c
+++ b/nimble/host/mesh/src/transport.c
@@ -994,6 +994,7 @@ static inline int32_t ack_timeout(struct seg_rx *rx)
 int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, uint8_t ctl_op, void *data,
                     size_t data_len, const struct bt_mesh_send_cb *cb, void 
*cb_data)
 {
+       int err;
        struct os_mbuf *buf = NET_BUF_SIMPLE(data_len);
 
        net_buf_simple_init_with_data(buf, data, data_len);
@@ -1022,11 +1023,12 @@ int bt_mesh_ctl_send(struct bt_mesh_net_tx *tx, uint8_t 
ctl_op, void *data,
        BT_DBG("len %zu: %s", data_len, bt_hex(data, data_len));
 
        if (tx->ctx->send_rel) {
-               return send_seg(tx, buf, cb, cb_data, &ctl_op);
+               err = send_seg(tx, buf, cb, cb_data, &ctl_op);
        } else {
-               return send_unseg(tx, buf, cb, cb_data, &ctl_op);
+               err = send_unseg(tx, buf, cb, cb_data, &ctl_op);
        }
        os_mbuf_free_chain(buf);
+       return err;
 }
 
 static int send_ack(struct bt_mesh_subnet *sub, uint16_t src, uint16_t dst,

Reply via email to