From: Alan T. DeKok Date: Mon, 18 Feb 2013 19:01:32 +0000 (-0500) Subject: cf_section_parse_free() recurses into sub-sections X-Git-Tag: release_3_0_0_beta1~1039 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ba044534e3efa8faf57acd953be7e4e863a9c9f9;p=thirdparty%2Ffreeradius-server.git cf_section_parse_free() recurses into sub-sections --- diff --git a/src/main/conffile.c b/src/main/conffile.c index c4b384fe71d..5ba0cada895 100644 --- a/src/main/conffile.c +++ b/src/main/conffile.c @@ -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; }