@@ -264,6 +264,7 @@ static struct mesh_node *node_new(const uint8_t uuid[16])
node = l_new(struct mesh_node, 1);
node->net = mesh_net_new(node);
node->elements = l_queue_new();
+ l_info("new elements: %p", node->elements);
memcpy(node->uuid, uuid, sizeof(node->uuid));
set_defaults(node);
@@ -274,8 +275,11 @@ static void free_element_path(void *a, void *b)
{
struct node_element *element = a;
+ l_info("el: %p, path: %p", element, element->path);
+
l_free(element->path);
element->path = NULL;
+
}
static void element_free(void *data)
@@ -289,6 +293,8 @@ static void element_free(void *data)
static void free_node_dbus_resources(struct mesh_node *node)
{
+ l_info("Node: %p", node);
+
if (!node)
return;
@@ -297,6 +303,8 @@ static void free_node_dbus_resources(struct mesh_node *node)
node->disc_watch = 0;
}
+ l_info("elements: %p", node->elements);
+
l_queue_foreach(node->elements, free_element_path, NULL);
l_free(node->owner);
node->owner = NULL;
@@ -332,12 +340,17 @@ static void free_node_resources(void *data)
/* Free dynamic resources */
free_node_dbus_resources(node);
+ l_info("log1");
l_queue_destroy(node->elements, element_free);
+ l_info("log2");
+ node->elements = NULL;
+ l_info("log3");
mesh_agent_remove(node->agent);
mesh_config_release(node->cfg);
mesh_net_free(node->net);
l_free(node->storage_dir);
l_free(node);
+ l_info("log4");
}
/*
@@ -1198,6 +1211,7 @@ static void convert_node_to_storage(struct mesh_node *node,
db_node->seq_number = node->seq_number;
db_node->elements = l_queue_new();
+ l_info("db_node->elements %p", db_node->elements);
entry = l_queue_get_entries(node->elements);
@@ -1354,6 +1368,8 @@ static bool add_local_node(struct mesh_node *node, uint16_t unicast, bool kr,
update_net_settings(node);
+ mesh_config_save(node->cfg, true, NULL, NULL);
+
/* Initialize configuration server model */
cfgmod_server_init(node, PRIMARY_ELE_IDX);
@@ -2352,6 +2411,8 @@ void node_finalize_new_node(struct mesh_node *node, struct mesh_io *io)
if (!node)
return;
+ l_info("Nnnnode: %p", node);
+
free_node_dbus_resources(node);
mesh_agent_remove(node->agent);