[BUG] config: reset check request to avoid double free when switching to ssl/sql

SSL and SQL checks did only perform a free() of the request without replacing
it, so having multiple SSL/SQL check declarations after another check type
causes a double free condition during config parsing. This should be backported
although it's harmless.
This commit is contained in:
Willy Tarreau 2010-02-01 16:31:14 +01:00
parent dc008c57a4
commit 54f6a586cd

View file

@ -2647,6 +2647,7 @@ stats_error_parsing:
/* use HTTP request to check servers' health */
free(curproxy->check_req);
curproxy->check_req = NULL;
curproxy->options &= ~PR_O_SSL3_CHK;
curproxy->options &= ~PR_O_SMTP_CHK;
curproxy->options2 &= ~PR_O2_MYSQL_CHK;
@ -2677,6 +2678,7 @@ stats_error_parsing:
err_code |= ERR_WARN;
free(curproxy->check_req);
curproxy->check_req = NULL;
curproxy->options &= ~PR_O_HTTP_CHK;
curproxy->options &= ~PR_O_SMTP_CHK;
curproxy->options2 &= ~PR_O2_MYSQL_CHK;
@ -2685,6 +2687,7 @@ stats_error_parsing:
else if (!strcmp(args[1], "smtpchk")) {
/* use SMTP request to check servers' health */
free(curproxy->check_req);
curproxy->check_req = NULL;
curproxy->options &= ~PR_O_HTTP_CHK;
curproxy->options &= ~PR_O_SSL3_CHK;
curproxy->options2 &= ~PR_O2_MYSQL_CHK;
@ -2710,6 +2713,7 @@ stats_error_parsing:
else if (!strcmp(args[1], "mysql-check")) {
/* use MYSQL request to check servers' health */
free(curproxy->check_req);
curproxy->check_req = NULL;
curproxy->options &= ~PR_O_HTTP_CHK;
curproxy->options &= ~PR_O_SSL3_CHK;
curproxy->options &= ~PR_O_SMTP_CHK;