mesh: free local mbuf chains

Free locally declared mbufs before functions return.
This commit is contained in:
Krzysztof Kopyściński
2021-01-12 14:05:19 +01:00
committed by Łukasz Rymanowski
parent 7ad5d4d8cb
commit 9897e56cfb
4 changed files with 15 additions and 0 deletions
+1
View File
@@ -233,6 +233,7 @@ struct os_mbuf *bt_mesh_adv_create_from_pool(struct os_mbuf_pool *pool,
ble_npl_event_set_arg(&adv->ev, buf);
return buf;
os_mbuf_free_chain(buf);
}
struct os_mbuf *bt_mesh_adv_create(enum bt_mesh_adv_type type, uint8_t xmit,
+6
View File
@@ -1068,6 +1068,7 @@ int bt_mesh_cfg_net_key_get(uint16_t net_idx, uint16_t addr, uint16_t *keys,
return err;
}
os_mbuf_free_chain(msg);
return cli_wait();
}
@@ -1107,6 +1108,7 @@ int bt_mesh_cfg_net_key_del(uint16_t net_idx, uint16_t addr,
return 0;
}
os_mbuf_free_chain(msg);
return cli_wait();
}
@@ -1188,6 +1190,7 @@ int bt_mesh_cfg_app_key_get(uint16_t net_idx, uint16_t addr, uint16_t key_net_id
return err;
}
os_mbuf_free_chain(msg);
return cli_wait();
}
@@ -1228,6 +1231,7 @@ int bt_mesh_cfg_app_key_del(uint16_t net_idx, uint16_t addr,
return 0;
}
os_mbuf_free_chain(msg);
return cli_wait();
}
@@ -1350,6 +1354,7 @@ static int mod_app_unbind(uint16_t net_idx, uint16_t addr, uint16_t elem_addr,
return 0;
}
os_mbuf_free_chain(msg);
return cli_wait();
}
@@ -1420,6 +1425,7 @@ static int mod_member_list_get(uint32_t op, uint32_t expect_op, uint16_t net_idx
return err;
}
os_mbuf_free_chain(msg);
return cli_wait();
}
+4
View File
@@ -336,6 +336,8 @@ static void send_app_key_status(struct bt_mesh_model *model,
if (bt_mesh_model_send(model, ctx, msg, NULL, NULL)) {
BT_ERR("Unable to send App Key Status response");
}
os_mbuf_free_chain(msg);
}
static void app_key_add(struct bt_mesh_model *model,
@@ -2120,6 +2122,8 @@ static void send_node_id_status(struct bt_mesh_model *model,
if (bt_mesh_model_send(model, ctx, msg, NULL, NULL)) {
BT_ERR("Unable to send Node Identity Status");
}
os_mbuf_free_chain(msg);
}
static void node_identity_get(struct bt_mesh_model *model,
+4
View File
@@ -551,6 +551,8 @@ static int send_seg(struct bt_mesh_net_tx *net_tx, struct os_mbuf *sdu,
*/
k_mem_slab_free(&segs, &buf);
tx->seg[seg_o] = NULL;
os_mbuf_free_chain(seg);
}
}
@@ -977,6 +979,7 @@ static int trans_unseg(struct os_mbuf *buf, struct bt_mesh_net_rx *rx,
/* Adjust the length to not contain the MIC at the end */
buf->om_len -= APP_MIC_LEN(0);
os_mbuf_free_chain(buf);
return sdu_recv(rx, hdr, 0, buf, sdu, NULL);
}
@@ -1474,6 +1477,7 @@ found_rx:
seg_rx_reset(rx, false);
os_mbuf_free_chain(buf);
return err;
}