Skip to content

Commit

Permalink
resolve memory leak on error
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobBarthelmeh committed Jan 9, 2025
1 parent 9d6643c commit ac09b58
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/tls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -6909,6 +6909,11 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
if (args->clSuites == NULL) {
ERROR_OUT(MEMORY_E, exit_dch);
}
#ifdef OPENSSL_EXTRA
/* hang on to client suites found and free the struct when WOLFSSL object
* is free'd */
ssl->clSuites = args->clSuites;
#endif

/* Cipher suites */
if ((args->idx - args->begin) + OPAQUE16_LEN > helloSz)
Expand Down Expand Up @@ -7081,7 +7086,6 @@ int DoTls13ClientHello(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
case TLS_ASYNC_DO:
{
#ifdef OPENSSL_EXTRA
ssl->clSuites = args->clSuites;
if ((ret = CertSetupCbWrapper(ssl)) != 0)
goto exit_dch;
#endif
Expand Down

0 comments on commit ac09b58

Please sign in to comment.