]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: ssl: ssl_sock_load_ocsp_response_from_file memory leak
authorEmmanuel Hocdet <manu@gandi.net>
Thu, 16 Jan 2020 13:41:36 +0000 (14:41 +0100)
committerWilliam Lallemand <wlallemand@haproxy.org>
Tue, 21 Jan 2020 09:44:33 +0000 (10:44 +0100)
"set ssl cert <filename.ocsp> <payload>" CLI command must free
previous context.

This patch should be backport to 2.1

src/ssl_sock.c

index fd350f39c0999bdbf9b3bb88506a42adc4d5db33..7d654bde827aa262a0506d9efd7de4606cf1b3ff 100644 (file)
@@ -1106,7 +1106,12 @@ static int ssl_sock_load_ocsp_response_from_file(const char *ocsp_path, char *bu
                ocsp_response = NULL;
                goto end;
        }
-
+       /* no error, fill ckch with new context, old context must be free */
+       if (ckch->ocsp_response) {
+               free(ckch->ocsp_response->area);
+               ckch->ocsp_response->area = NULL;
+               free(ckch->ocsp_response);
+       }
        ckch->ocsp_response = ocsp_response;
        ret = 0;
 end: