]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- free acl-tags, acltag-action and acltag-data config lists during
authorWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 6 Jun 2016 14:57:24 +0000 (14:57 +0000)
committerWouter Wijngaards <wouter@nlnetlabs.nl>
Mon, 6 Jun 2016 14:57:24 +0000 (14:57 +0000)
  initialisation to free up memory for more entries.

git-svn-id: file:///svn/unbound/trunk@3761 be551aaa-1e26-0410-a405-d3ace91eadb9

daemon/acl_list.c
doc/Changelog

index a6b8ee0e1962ae56598df4b7c7b8eb5e37a80a6e..4d40b092c946fa41ee8f97fa2a0a15f997762496 100644 (file)
@@ -294,11 +294,18 @@ read_acl_list(struct acl_list* acl, struct config_file* cfg)
 static int 
 read_acl_tags(struct acl_list* acl, struct config_file* cfg)
 {
-       struct config_strbytelist* p;
-       for(p = cfg->acl_tags; p; p = p->next) {
+       struct config_strbytelist* np, *p = cfg->acl_tags;
+       cfg->acl_tags = NULL;
+       while(p) {
                log_assert(p->str && p->str2);
                if(!acl_list_tags_cfg(acl, p->str, p->str2, p->str2len))
                        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;
 }
@@ -307,12 +314,23 @@ read_acl_tags(struct acl_list* acl, struct config_file* cfg)
 static int 
 read_acl_tag_actions(struct acl_list* acl, struct config_file* cfg)
 {
-       struct config_str3list* p;
-       for(p = cfg->acl_tag_actions; p; p = p->next) {
+       struct config_str3list* p, *np;
+       p = cfg->acl_tag_actions;
+       cfg->acl_tag_actions = NULL;
+       while(p) {
                log_assert(p->str && p->str2 && p->str3);
                if(!acl_list_tag_action_cfg(acl, cfg, p->str, p->str2,
-                       p->str3))
+                       p->str3)) {
+                       config_deltrplstrlist(p);
                        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;
 }
@@ -321,11 +339,22 @@ read_acl_tag_actions(struct acl_list* acl, struct config_file* cfg)
 static int 
 read_acl_tag_datas(struct acl_list* acl, struct config_file* cfg)
 {
-       struct config_str3list* p;
-       for(p = cfg->acl_tag_datas; p; p = p->next) {
+       struct config_str3list* p, *np;
+       p = cfg->acl_tag_datas;
+       cfg->acl_tag_datas = NULL;
+       while(p) {
                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;
+               }
+               /* 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;
 }
index 98d42f0e27e88d269d81203612b218244229dd02..5279952286f3873d53e09b8e897291be6936e544 100644 (file)
@@ -4,6 +4,8 @@
        - local-zone-override config directive.
        - access-control-tag-action and access-control-tag-data config
          directives.
+       - free acl-tags, acltag-action and acltag-data config lists during
+         initialisation to free up memory for more entries.
 
 3 June 2016: Wouter
        - Fix to not ignore return value of chown() in daemon startup.