[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.
diff --git a/src/cfgparse.c b/src/cfgparse.c
index 4263f94..4036e29 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -2647,6 +2647,7 @@
/* 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 @@
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 @@
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 @@
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;