From: David Carlier Date: Fri, 25 Sep 2015 10:49:18 +0000 (+0100) Subject: MINOR: cfgparse: New function cfg_unregister_sections() X-Git-Tag: v1.6-dev6~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=845efb53c7bb2c838c98308ffe33ab1d2c6c5e3c;p=thirdparty%2Fhaproxy.git MINOR: cfgparse: New function cfg_unregister_sections() A new function introduced meant to be called during general deinit phase. During the configuration parsing, the section entries are all allocated. This new function free them. --- diff --git a/include/common/cfgparse.h b/include/common/cfgparse.h index 86a0035145..d785327711 100644 --- a/include/common/cfgparse.h +++ b/include/common/cfgparse.h @@ -73,6 +73,7 @@ int check_config_validity(); int str2listener(char *str, struct proxy *curproxy, struct bind_conf *bind_conf, const char *file, int line, char **err); int cfg_register_section(char *section_name, int (*section_parser)(const char *, int, char **, int)); +void cfg_unregister_sections(void); int warnif_misplaced_tcp_conn(struct proxy *proxy, const char *file, int line, const char *arg); int warnif_misplaced_tcp_cont(struct proxy *proxy, const char *file, int line, const char *arg); diff --git a/src/cfgparse.c b/src/cfgparse.c index d732ac3286..b40588fb6e 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -8846,6 +8846,19 @@ int cfg_register_section(char *section_name, return 1; } +/* + * free all config section entries + */ +void cfg_unregister_sections(void) +{ + struct cfg_section *cs, *ics; + + list_for_each_entry_safe(cs, ics, §ions, list) { + LIST_DEL(&cs->list); + free(cs); + } +} + /* * Local variables: * c-indent-level: 8