Skip to content
Snippets Groups Projects
Commit 1525f7bd authored by Jakob Olsson's avatar Jakob Olsson
Browse files

agent radiolist memory cleanup

parent aa814e1a
Branches
No related tags found
1 merge request!108Radiolist cleanup
Pipeline #48075 passed
...@@ -126,14 +126,11 @@ static int clean_steer_excl(struct node_policy *p) ...@@ -126,14 +126,11 @@ static int clean_steer_excl(struct node_policy *p)
return 0; return 0;
} }
int clean_agent_policies(struct controller_config *cfg) int clean_radio_list(struct list_head *radiolist)
{ {
struct node_policy *p = NULL, *tmp; struct radio_policy *p = NULL, *tmp;
list_for_each_entry_safe(p, tmp, &cfg->nodelist, list) { list_for_each_entry_safe(p, tmp, radiolist, list) {
clean_steer_btm_excl(p);
clean_steer_excl(p);
clean_agentlist(p);
list_del(&p->list); list_del(&p->list);
free(p); free(p);
} }
...@@ -141,11 +138,15 @@ int clean_agent_policies(struct controller_config *cfg) ...@@ -141,11 +138,15 @@ int clean_agent_policies(struct controller_config *cfg)
return 0; return 0;
} }
int clean_cred_list(struct controller_config *cfg) int clean_agent_policies(struct controller_config *cfg)
{ {
struct iface_credential *p = NULL, *tmp; struct node_policy *p = NULL, *tmp;
list_for_each_entry_safe(p, tmp, &cfg->aplist, list) { list_for_each_entry_safe(p, tmp, &cfg->nodelist, list) {
clean_steer_btm_excl(p);
clean_steer_excl(p);
clean_agentlist(p);
clean_radio_list(&p->radiolist);
list_del(&p->list); list_del(&p->list);
free(p); free(p);
} }
...@@ -153,11 +154,11 @@ int clean_cred_list(struct controller_config *cfg) ...@@ -153,11 +154,11 @@ int clean_cred_list(struct controller_config *cfg)
return 0; return 0;
} }
int clean_radio_list(struct controller_config *cfg) int clean_cred_list(struct controller_config *cfg)
{ {
struct radio_policy *p = NULL, *tmp; struct iface_credential *p = NULL, *tmp;
list_for_each_entry_safe(p, tmp, &cfg->radiolist, list) { list_for_each_entry_safe(p, tmp, &cfg->aplist, list) {
list_del(&p->list); list_del(&p->list);
free(p); free(p);
} }
...@@ -1269,7 +1270,7 @@ uint8_t cntlr_config_reload(struct controller_config *cfg) ...@@ -1269,7 +1270,7 @@ uint8_t cntlr_config_reload(struct controller_config *cfg)
/* clean old lists */ /* clean old lists */
clean_cred_list(&old); clean_cred_list(&old);
clean_agent_policies(&old); /* cleans nodelist */ clean_agent_policies(&old); /* cleans nodelist */
clean_radio_list(&old); clean_radio_list(&old.radiolist);
uci_free_context(ctx); uci_free_context(ctx);
...@@ -1280,6 +1281,6 @@ int cntlr_config_clean(struct controller_config *cfg) ...@@ -1280,6 +1281,6 @@ int cntlr_config_clean(struct controller_config *cfg)
{ {
clean_cred_list(cfg); clean_cred_list(cfg);
clean_agent_policies(cfg); /* cleans nodelist */ clean_agent_policies(cfg); /* cleans nodelist */
clean_radio_list(cfg); clean_radio_list(&cfg->radiolist);
return 0; return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment