nimble/gatts: Fix use of uninitialized variable

new_notification was set to 1 only on complete iteration of loop. If
ble_hs_conn_find_by_idx would return NULL on first iteration it would
be used uninitialized


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/3f1ea82a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/3f1ea82a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/3f1ea82a

Branch: refs/heads/develop
Commit: 3f1ea82ac4ef1043f595ccc7ded14d57279efa62
Parents: 4e7d583
Author: Szymon Janc <[email protected]>
Authored: Mon Jan 30 17:03:15 2017 +0100
Committer: Szymon Janc <[email protected]>
Committed: Mon Jan 30 17:03:15 2017 +0100

----------------------------------------------------------------------
 net/nimble/host/src/ble_gatts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/3f1ea82a/net/nimble/host/src/ble_gatts.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gatts.c b/net/nimble/host/src/ble_gatts.c
index ae9f3fb..39bf350 100644
--- a/net/nimble/host/src/ble_gatts.c
+++ b/net/nimble/host/src/ble_gatts.c
@@ -1443,7 +1443,7 @@ ble_gatts_chr_updated(uint16_t chr_val_handle)
     struct ble_store_key_cccd cccd_key;
     struct ble_gatts_clt_cfg *clt_cfg;
     struct ble_hs_conn *conn;
-    int new_notifications;
+    int new_notifications = 0;
     int clt_cfg_idx;
     int persist;
     int rc;

Reply via email to