From 02d37f08fc7152a5eec774f8f2667633ceb9e824 Mon Sep 17 00:00:00 2001 From: Stefan Eissing Date: Thu, 20 Oct 2022 12:33:08 +0200 Subject: [PATCH] Do not direclty return but goto exit label for cleanup of allocated resources in case ALPN selection or SNI callback fails. --- src/tls13.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tls13.c b/src/tls13.c index bb9b2ac0e..7cbe43cc5 100644 --- a/src/tls13.c +++ b/src/tls13.c @@ -5863,7 +5863,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx, #ifdef HAVE_SNI if ((ret = SNI_Callback(ssl)) != 0) - return ret; + goto exit_dch; ssl->options.side = WOLFSSL_SERVER_END; #endif @@ -5954,7 +5954,7 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx, /* With PSK and all other things validated, it's time to * select the ALPN protocol, if so requested */ if ((ret = ALPN_Select(ssl)) != 0) - return ret; + goto exit_dch; #endif /* Advance state and proceed */ ssl->options.asyncState = TLS_ASYNC_BUILD;