]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: ssl: don't alloc ssl_conf if no option found
authorWilliam Lallemand <wlallemand@haproxy.com>
Fri, 10 Apr 2020 15:20:45 +0000 (17:20 +0200)
committerWilliam Lallemand <wlallemand@haproxy.org>
Fri, 10 Apr 2020 15:43:58 +0000 (17:43 +0200)
When no SSL options were found between brackets, the structure ssl_conf
was still allocated for nothing.

src/ssl_sock.c

index 1cd701e61345e7f05280ab46cb564b3f5028b081..376e624115eb85c473b6c35f7e139f30c4d3e6c6 100644 (file)
@@ -4784,11 +4784,13 @@ static int crtlist_parse_line(char *line, char **crt_path, struct crtlist_entry
 
        *crt_path = args[0];
 
-       ssl_conf = calloc(1, sizeof *ssl_conf);
-       if (!ssl_conf) {
-               memprintf(err, "not enough memory!");
-               cfgerr |= ERR_ALERT | ERR_FATAL;
-               goto error;
+       if (ssl_b) {
+               ssl_conf = calloc(1, sizeof *ssl_conf);
+               if (!ssl_conf) {
+                       memprintf(err, "not enough memory!");
+                       cfgerr |= ERR_ALERT | ERR_FATAL;
+                       goto error;
+               }
        }
        cur_arg = ssl_b ? ssl_b : 1;
        while (cur_arg < ssl_e) {