You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by we...@apache.org on 2016/08/11 21:27:11 UTC
[11/50] [abbrv] incubator-mynewt-core git commit: BLE Host - Free
mbufs on exec-write-failure
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/f0cff8c0
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/f0cff8c0
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/f0cff8c0
Branch: refs/heads/phyrx_no_mbuf
Commit: f0cff8c068950c36a651af6f17ed53f8f9737e81
Parents: c46ed0c
Author: Christopher Collins <cc...@apache.org>
Authored: Sun Aug 7 02:34:00 2016 -0700
Committer: William San Filippo <wi...@runtime.io>
Committed: Thu Aug 11 14:26:25 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/f0cff8c0/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;