Do not direclty return but goto exit label for cleanup of allocated resources in case ALPN selection or SNI callback fails.

This commit is contained in:
Stefan Eissing
2022-10-20 12:33:08 +02:00
parent 057fdd30d3
commit 02d37f08fc

View File

@ -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;