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.
This commit is contained in:
Thierry FOURNIER 2014-06-11 14:45:31 +02:00 committed by Willy Tarreau
parent 75ab8bdb83
commit 148f40866b

View File

@ -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) {