]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
cf_section_parse_free() recurses into sub-sections
authorAlan T. DeKok <aland@freeradius.org>
Mon, 18 Feb 2013 19:01:32 +0000 (14:01 -0500)
committerAlan T. DeKok <aland@freeradius.org>
Mon, 18 Feb 2013 19:01:32 +0000 (14:01 -0500)
src/main/conffile.c

index c4b384fe71de9a25b05d892cd651762fe1e7e8cb..5ba0cada89570596a0d0939a76030c9dee76ee4f 100644 (file)
@@ -310,6 +310,18 @@ void cf_section_parse_free(CONF_SECTION *cs, void *base)
 
                type = variables[i].type & ~PW_TYPE_DEPRECATED;
 
+               if (type == PW_TYPE_SUBSECTION) {
+                       CONF_SECTION *subcs;
+                       subcs = cf_section_sub_find(cs, variables[i].name);
+
+                       if (!subcs) continue;
+
+                       if (!variables[i].dflt) continue;
+
+                       cf_section_parse_free(subcs, base);
+                       continue;
+               }
+
                if ((type != PW_TYPE_STRING_PTR) &&
                    (type != PW_TYPE_FILENAME)) {
                        continue;
@@ -337,6 +349,8 @@ void cf_section_parse_free(CONF_SECTION *cs, void *base)
                free(*p);
                *p = NULL;
        }
+
+       cs->variables = NULL;
 }