]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] config: reset check request to avoid double free when switching to ssl/sql
authorWilly Tarreau <w@1wt.eu>
Mon, 1 Feb 2010 15:31:14 +0000 (16:31 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 1 Feb 2010 15:32:37 +0000 (16:32 +0100)
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.

src/cfgparse.c

index 4263f943240dacd1fd7140100d852d015f27f388..4036e29b55996ea2fe92b66b7a403a9329e4105a 100644 (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;