Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
map-controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Multi-AP
map-controller
Commits
f930b8a5
Commit
f930b8a5
authored
3 years ago
by
Filip Matusiak
Committed by
Jakob Olsson
3 years ago
Browse files
Options
Downloads
Patches
Plain Diff
fix memleak in cntlr_config_reload
parent
b708f6ed
No related branches found
No related tags found
1 merge request
!96
fix memleaks in controller
Pipeline
#44688
passed
3 years ago
Stage: static_code_analysis
Changes
1
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/config.c
+27
-9
27 additions, 9 deletions
src/config.c
with
27 additions
and
9 deletions
src/config.c
+
27
−
9
View file @
f930b8a5
...
...
@@ -141,11 +141,23 @@ int clean_agent_policies(struct controller_config *cfg)
return
0
;
}
int
clean_cred
s
list
(
struct
list_head
*
credslist
)
int
clean_cred
_
list
(
struct
controller_config
*
cfg
)
{
struct
iface_credential
*
p
=
NULL
,
*
tmp
;
list_for_each_entry_safe
(
p
,
tmp
,
credslist
,
list
)
{
list_for_each_entry_safe
(
p
,
tmp
,
&
cfg
->
aplist
,
list
)
{
list_del
(
&
p
->
list
);
free
(
p
);
}
return
0
;
}
int
clean_radio_list
(
struct
controller_config
*
cfg
)
{
struct
radio_policy
*
p
=
NULL
,
*
tmp
;
list_for_each_entry_safe
(
p
,
tmp
,
&
cfg
->
radiolist
,
list
)
{
list_del
(
&
p
->
list
);
free
(
p
);
}
...
...
@@ -1017,6 +1029,7 @@ static int cntlr_config_get_agent_radio(struct controller_config *c,
a
->
report_rcpi_threshold
=
a
->
rcpi_threshold
+
10
;
a
->
include_sta_stats
=
true
;
a
->
include_sta_metric
=
true
;
list_add
(
&
a
->
list
,
&
c
->
radiolist
);
}
else
{
warn
(
"|%s:%d| invalid radio config! Must hold agent_id, macaddr and band"
,
__func__
,
__LINE__
);
...
...
@@ -1151,14 +1164,16 @@ uint8_t cntlr_config_diff(struct controller_config *cfg,
void
config_copy_cntlr_config
(
struct
controller_config
*
curr
,
struct
controller_config
*
old
)
{
INIT_LIST_HEAD
(
&
old
->
ap
list
);
INIT_LIST_HEAD
(
&
old
->
radio
list
);
INIT_LIST_HEAD
(
&
old
->
nodelist
);
INIT_LIST_HEAD
(
&
old
->
aplist
);
old
->
num_bss
=
curr
->
num_bss
;
old
->
num_apolicy
=
curr
->
num_apolicy
;
list_copy
(
&
curr
->
ap
list
,
&
old
->
ap
list
,
struct
iface_credential
);
list_copy
(
&
curr
->
radio
list
,
&
old
->
radio
list
,
struct
radio_policy
);
list_copy
(
&
curr
->
nodelist
,
&
old
->
nodelist
,
struct
node_policy
);
list_copy
(
&
curr
->
aplist
,
&
old
->
aplist
,
struct
iface_credential
);
}
uint8_t
cntlr_config_reload
(
struct
controller_config
*
cfg
)
...
...
@@ -1196,22 +1211,25 @@ uint8_t cntlr_config_reload(struct controller_config *cfg)
}
}
config_map_radios_to_node
(
cfg
);
/* get bitmap of what sections changed */
diff
=
cntlr_config_diff
(
cfg
,
&
old
);
/* clean old lists */
clean_credslist
(
&
old
.
aplist
);
clean_agent_policies
(
&
old
);
clean_cred_list
(
&
old
);
clean_agent_policies
(
&
old
);
/* cleans nodelist */
clean_radio_list
(
&
old
);
uci_free_context
(
ctx
);
return
diff
;
}
int
cntlr_config_clean
(
struct
controller_config
*
cfg
)
{
clean_agent_policies
(
cfg
);
clean_credslist
(
&
cfg
->
aplist
);
clean_cred_list
(
cfg
);
clean_agent_policies
(
cfg
);
/* cleans nodelist */
clean_radio_list
(
cfg
);
return
0
;
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment