From: Fabian Keil <fk@fabiankeil.de>
Date: Fri, 15 May 2020 12:08:58 +0000 (+0200)
Subject: create_server_ssl_connection(): Free certificate chain when the handshake fails
X-Git-Tag: v_3_0_29~418
X-Git-Url: http://www.privoxy.org/gitweb/%22https:/faq/@default-cgi@/developer-manual/static/diff?a=commitdiff_plain;h=191e671fa862fbddd20fe2e61e2ef9c7d173ddcf;p=privoxy.git

create_server_ssl_connection(): Free certificate chain when the handshake fails

Fixes a memory leak.

Sponsored by: Robert Klemme
---

diff --git a/ssl.c b/ssl.c
index c9e09a70..a7bf7096 100644
--- 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;