From: Thierry FOURNIER Date: Wed, 11 Jun 2014 12:45:31 +0000 (+0200) Subject: MINOR: regex: fix a little configuration memory leak. X-Git-Tag: v1.5.0~23 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=148f40866bd8b8804549a00c48f0a3d235a66829;p=thirdparty%2Fhaproxy.git MINOR: regex: fix a little configuration memory leak. The function regfree free the memory allocated to the pattern buffer by the compiling process. It is not freeing the buffer itself. --- diff --git a/src/cfgparse.c b/src/cfgparse.c index 017bcae029..eb40833742 100644 --- a/src/cfgparse.c +++ b/src/cfgparse.c @@ -2118,7 +2118,11 @@ int cfg_parse_listen(const char *file, int linenum, char **args, int kwm) free(defproxy.server_id_hdr_name); defproxy.server_id_hdr_len = 0; free(defproxy.expect_str); - if (defproxy.expect_regex) regfree(defproxy.expect_regex); + if (defproxy.expect_regex) { + regfree(defproxy.expect_regex); + free(defproxy.expect_regex); + defproxy.expect_regex = NULL; + } if (defproxy.conf.logformat_string != default_http_log_format && defproxy.conf.logformat_string != default_tcp_log_format && @@ -4208,7 +4212,11 @@ stats_error_parsing: } curproxy->options2 |= PR_O2_EXP_RSTS; free(curproxy->expect_str); - if (curproxy->expect_regex) regfree(curproxy->expect_regex); + if (curproxy->expect_regex) { + regfree(curproxy->expect_regex); + free(curproxy->expect_regex); + curproxy->expect_regex = NULL; + } curproxy->expect_str = strdup(args[cur_arg + 1]); curproxy->expect_regex = calloc(1, sizeof(regex_t)); if (regcomp(curproxy->expect_regex, args[cur_arg + 1], REG_EXTENDED) != 0) { @@ -4227,7 +4235,11 @@ stats_error_parsing: } curproxy->options2 |= PR_O2_EXP_RSTR; free(curproxy->expect_str); - if (curproxy->expect_regex) regfree(curproxy->expect_regex); + if (curproxy->expect_regex) { + regfree(curproxy->expect_regex); + free(curproxy->expect_regex); + curproxy->expect_regex = NULL; + } curproxy->expect_str = strdup(args[cur_arg + 1]); curproxy->expect_regex = calloc(1, sizeof(regex_t)); if (regcomp(curproxy->expect_regex, args[cur_arg + 1], REG_EXTENDED) != 0) {