sensing: sensor_mgmt: Use kernel heap for allocations
Use the kernel heap instead of the libc heap, improving security and consistency. Signed-off-by: Ibrahim Abdalkader <i.abdalkader@gmail.com>
This commit is contained in:
committed by
Fabio Baltieri
parent
afa47a2765
commit
0c5e7a6a95
@@ -1 +1,2 @@
|
||||
CONFIG_LOG=y
|
||||
CONFIG_HEAP_MEM_POOL_SIZE=2048
|
||||
|
||||
@@ -35,7 +35,7 @@ config MCUMGR_GRP_SETTINGS_BUFFER_TYPE_HEAP
|
||||
depends on HEAP_MEM_POOL_SIZE > 0
|
||||
help
|
||||
Use dynamic heap memory allocation through k_malloc, if there is insufficient heap
|
||||
memory for the allocation then the request will be rejected.
|
||||
memory for the allocation then the request will be rejected.
|
||||
|
||||
endchoice
|
||||
|
||||
|
||||
@@ -342,7 +342,7 @@ int open_sensor(struct sensing_sensor *sensor, struct sensing_connection **conn)
|
||||
}
|
||||
|
||||
/* create connection from sensor to application(client = NULL) */
|
||||
tmp_conn = malloc(sizeof(*tmp_conn));
|
||||
tmp_conn = k_malloc(sizeof(*tmp_conn));
|
||||
if (!tmp_conn) {
|
||||
return -ENOMEM;
|
||||
}
|
||||
@@ -371,7 +371,7 @@ int close_sensor(struct sensing_connection **conn)
|
||||
|
||||
save_config_and_notify(tmp_conn->source);
|
||||
|
||||
free(*conn);
|
||||
k_free(*conn);
|
||||
*conn = NULL;
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user