summaryrefslogtreecommitdiff
path: root/mesh/mesh-config-json.c
diff options
context:
space:
mode:
authorBrian Gix <brian.gix@intel.com>2020-05-20 15:14:38 -0700
committerBrian Gix <brian.gix@intel.com>2020-05-20 15:16:55 -0700
commit0e8ed1f261cf336ce1ec8b3b514e4794ac8f058c (patch)
treecc168ed8a283d7d66b83a5dd828514e8a25e1dea /mesh/mesh-config-json.c
parent5b6536954b53afe1eebb4d54578cb45953456023 (diff)
downloadbluez-0e8ed1f261cf336ce1ec8b3b514e4794ac8f058c.tar.gz
mesh: Fix double-free
This fixes a double-free error when destroying the NVM storage of a mesh node. Cleanly handle two distinct scenarios: 1. When the node is being deleted at runtime. This causes release of both dynamic memory and NVM storage. 2. During shutdown, we release dynamic memory only.
Diffstat (limited to 'mesh/mesh-config-json.c')
-rw-r--r--mesh/mesh-config-json.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/mesh/mesh-config-json.c b/mesh/mesh-config-json.c
index 6567d761c..d3f423e50 100644
--- a/mesh/mesh-config-json.c
+++ b/mesh/mesh-config-json.c
@@ -2309,7 +2309,7 @@ bool mesh_config_load_nodes(const char *cfgdir_name, mesh_config_node_func_t cb,
return true;
}
-void mesh_config_destroy(struct mesh_config *cfg)
+void mesh_config_destroy_nvm(struct mesh_config *cfg)
{
char *node_dir, *node_name;
char uuid[33];
@@ -2330,7 +2330,4 @@ void mesh_config_destroy(struct mesh_config *cfg)
return;
del_path(node_dir);
-
- /* Release node config object */
- mesh_config_release(cfg);
}