Bluetooth: Mesh: Fix heartbeat publication storing
This fixes usage of an uninitialized variable (to_store) as introduced
by commit bfad2a0
.
Fixes #12314
Signed-off-by: Johan Hedberg <johan.hedberg@intel.com>
This commit is contained in:
parent
3d0950e59a
commit
d57a9a648b
|
@ -987,7 +987,6 @@ static void store_pending_hb_pub(void)
|
|||
{
|
||||
struct bt_mesh_hb_pub *pub = bt_mesh_hb_pub_get();
|
||||
struct hb_pub_val val;
|
||||
void *to_store;
|
||||
int err;
|
||||
|
||||
if (!pub) {
|
||||
|
@ -995,7 +994,7 @@ static void store_pending_hb_pub(void)
|
|||
}
|
||||
|
||||
if (pub->dst == BT_MESH_ADDR_UNASSIGNED) {
|
||||
to_store = NULL;
|
||||
err = settings_delete("bt/mesh/HBPub");
|
||||
} else {
|
||||
val.indefinite = (pub->count == 0xffff);
|
||||
val.dst = pub->dst;
|
||||
|
@ -1003,18 +1002,14 @@ static void store_pending_hb_pub(void)
|
|||
val.ttl = pub->ttl;
|
||||
val.feat = pub->feat;
|
||||
val.net_idx = pub->net_idx;
|
||||
|
||||
err = settings_save_one("bt/mesh/HBPub", &val, sizeof(val));
|
||||
}
|
||||
|
||||
err = settings_save_one("bt/mesh/HBPub", to_store,
|
||||
(to_store) ? sizeof(val) : 0);
|
||||
if (err) {
|
||||
BT_ERR("Failed to store Heartbeat Publication");
|
||||
} else {
|
||||
if (to_store) {
|
||||
BT_DBG("Stored Heartbeat Publication");
|
||||
} else {
|
||||
BT_DBG("Stored Heartbeat Publication as (null) value");
|
||||
}
|
||||
BT_DBG("Stored Heartbeat Publication");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue