create_server_ssl_connection(): Free certificate chain when the handshake fails
authorFabian Keil <fk@fabiankeil.de>
Fri, 15 May 2020 12:08:58 +0000 (14:08 +0200)
committerFabian Keil <fk@fabiankeil.de>
Sat, 16 May 2020 09:10:49 +0000 (11:10 +0200)
Fixes a memory leak.

Sponsored by: Robert Klemme

ssl.c

diff --git a/ssl.c b/ssl.c
index c9e09a7..a7bf709 100644 (file)
--- a/ssl.c
+++ b/ssl.c
@@ -828,6 +828,7 @@ extern int create_server_ssl_connection(struct client_state *csp)
          {
             log_error(LOG_LEVEL_ERROR,
                "mbedtls_ssl_handshake with server failed: %s", err_buf);
+            free_certificate_chain(csp);
             ret = -1;
          }
          goto exit;