- free acl-tags, acltag-action and acltag-data config lists during

initialisation to free up memory for more entries.


git-svn-id: file:///svn/unbound/trunk@3761 be551aaa-1e26-0410-a405-d3ace91eadb9
This commit is contained in:
Wouter Wijngaards 2016-06-06 14:57:24 +00:00
parent 886a4fb7f1
commit 2cc017981b
2 changed files with 39 additions and 8 deletions

View file

@ -294,11 +294,18 @@ read_acl_list(struct acl_list* acl, struct config_file* cfg)
static int static int
read_acl_tags(struct acl_list* acl, struct config_file* cfg) read_acl_tags(struct acl_list* acl, struct config_file* cfg)
{ {
struct config_strbytelist* p; struct config_strbytelist* np, *p = cfg->acl_tags;
for(p = cfg->acl_tags; p; p = p->next) { cfg->acl_tags = NULL;
while(p) {
log_assert(p->str && p->str2); log_assert(p->str && p->str2);
if(!acl_list_tags_cfg(acl, p->str, p->str2, p->str2len)) if(!acl_list_tags_cfg(acl, p->str, p->str2, p->str2len))
return 0; return 0;
/* free the items as we go to free up memory */
np = p->next;
free(p->str);
free(p->str2);
free(p);
p = np;
} }
return 1; return 1;
} }
@ -307,13 +314,24 @@ read_acl_tags(struct acl_list* acl, struct config_file* cfg)
static int static int
read_acl_tag_actions(struct acl_list* acl, struct config_file* cfg) read_acl_tag_actions(struct acl_list* acl, struct config_file* cfg)
{ {
struct config_str3list* p; struct config_str3list* p, *np;
for(p = cfg->acl_tag_actions; p; p = p->next) { p = cfg->acl_tag_actions;
cfg->acl_tag_actions = NULL;
while(p) {
log_assert(p->str && p->str2 && p->str3); log_assert(p->str && p->str2 && p->str3);
if(!acl_list_tag_action_cfg(acl, cfg, p->str, p->str2, if(!acl_list_tag_action_cfg(acl, cfg, p->str, p->str2,
p->str3)) p->str3)) {
config_deltrplstrlist(p);
return 0; return 0;
} }
/* free the items as we go to free up memory */
np = p->next;
free(p->str);
free(p->str2);
free(p->str3);
free(p);
p = np;
}
return 1; return 1;
} }
@ -321,12 +339,23 @@ read_acl_tag_actions(struct acl_list* acl, struct config_file* cfg)
static int static int
read_acl_tag_datas(struct acl_list* acl, struct config_file* cfg) read_acl_tag_datas(struct acl_list* acl, struct config_file* cfg)
{ {
struct config_str3list* p; struct config_str3list* p, *np;
for(p = cfg->acl_tag_datas; p; p = p->next) { p = cfg->acl_tag_datas;
cfg->acl_tag_datas = NULL;
while(p) {
log_assert(p->str && p->str2 && p->str3); log_assert(p->str && p->str2 && p->str3);
if(!acl_list_tag_data_cfg(acl, cfg, p->str, p->str2, p->str3)) if(!acl_list_tag_data_cfg(acl, cfg, p->str, p->str2, p->str3)) {
config_deltrplstrlist(p);
return 0; return 0;
} }
/* free the items as we go to free up memory */
np = p->next;
free(p->str);
free(p->str2);
free(p->str3);
free(p);
p = np;
}
return 1; return 1;
} }

View file

@ -4,6 +4,8 @@
- local-zone-override config directive. - local-zone-override config directive.
- access-control-tag-action and access-control-tag-data config - access-control-tag-action and access-control-tag-data config
directives. directives.
- free acl-tags, acltag-action and acltag-data config lists during
initialisation to free up memory for more entries.
3 June 2016: Wouter 3 June 2016: Wouter
- Fix to not ignore return value of chown() in daemon startup. - Fix to not ignore return value of chown() in daemon startup.