You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by cc...@apache.org on 2016/08/07 09:50:24 UTC
incubator-mynewt-core git commit: BLE Host - Free mbufs on
exec-write-failure
Repository: incubator-mynewt-core
Updated Branches:
refs/heads/develop 50d349b9f -> 36de005b3
BLE Host - Free mbufs on exec-write-failure
The previous fix didn't fix an mbuf leak. It added one! The real bug
was that an exec-write-response (success) gets sent when a write fails.
This commit fixes the mbuf leak that was introduced.
Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/36de005b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/36de005b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/36de005b
Branch: refs/heads/develop
Commit: 36de005b3dc0b18aeace6d58d9a7f167294fba2a
Parents: 50d349b
Author: Christopher Collins <cc...@apache.org>
Authored: Sun Aug 7 02:34:00 2016 -0700
Committer: Christopher Collins <cc...@apache.org>
Committed: Sun Aug 7 02:34:00 2016 -0700
----------------------------------------------------------------------
net/nimble/host/src/ble_att_svr.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/36de005b/net/nimble/host/src/ble_att_svr.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_svr.c b/net/nimble/host/src/ble_att_svr.c
index b3dd2f3..1b420b5 100644
--- a/net/nimble/host/src/ble_att_svr.c
+++ b/net/nimble/host/src/ble_att_svr.c
@@ -2342,16 +2342,19 @@ ble_att_svr_prep_write(uint16_t conn_handle,
ble_att_svr_prep_extract(prep_list, &attr_handle, &om);
attr = ble_att_svr_find_by_handle(attr_handle);
+ *err_handle = attr_handle;
if (attr == NULL) {
rc = BLE_ATT_ERR_INVALID_HANDLE;
- *err_handle = attr_handle;
} else {
rc = ble_att_svr_write(conn_handle, attr, 0, &om, &att_err);
- os_mbuf_free_chain(om);
if (rc != 0) {
- return att_err;
+ rc = att_err;
}
}
+ os_mbuf_free_chain(om);
+ if (rc != 0) {
+ return rc;
+ }
}
return 0;