ble_mesh: Fix dereferencing pointer before checking for NULL [Zephyr]
The publication context is checked for NULL in bt_mesh_model_publish() however it was dereferenced before that. Move the assignment to ctx.send_rel to the same place where other ctx members are set.
This commit is contained in:
parent
8f5564af84
commit
cffbc32253
1 changed files with 2 additions and 3 deletions
|
@ -1032,9 +1032,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
|
||||||
struct bt_mesh_model_pub *pub = model->pub;
|
struct bt_mesh_model_pub *pub = model->pub;
|
||||||
struct bt_mesh_app_key *key = NULL;
|
struct bt_mesh_app_key *key = NULL;
|
||||||
struct net_buf_simple *sdu = NULL;
|
struct net_buf_simple *sdu = NULL;
|
||||||
struct bt_mesh_msg_ctx ctx = {
|
struct bt_mesh_msg_ctx ctx = {0};
|
||||||
.send_rel = pub->send_rel,
|
|
||||||
};
|
|
||||||
struct bt_mesh_net_tx tx = {
|
struct bt_mesh_net_tx tx = {
|
||||||
.sub = NULL,
|
.sub = NULL,
|
||||||
.ctx = &ctx,
|
.ctx = &ctx,
|
||||||
|
@ -1072,6 +1070,7 @@ int bt_mesh_model_publish(struct bt_mesh_model *model)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx.addr = pub->addr;
|
ctx.addr = pub->addr;
|
||||||
|
ctx.send_rel = pub->send_rel;
|
||||||
ctx.send_ttl = pub->ttl;
|
ctx.send_ttl = pub->ttl;
|
||||||
ctx.net_idx = key->net_idx;
|
ctx.net_idx = key->net_idx;
|
||||||
ctx.app_idx = key->app_idx;
|
ctx.app_idx = key->app_idx;
|
||||||
|
|
Loading…
Reference in a new issue