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 bdc1b19
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/tls13.c
Original file line number Diff line number Diff line change
Expand Up @@ -6909,6 +6909,12 @@ 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 */
XFREE(ssl->clSuites, ssl->heap, DYNAMIC_TYPE_SUITES);
ssl->clSuites = args->clSuites;
#endif

/* Cipher suites */
if ((args->idx - args->begin) + OPAQUE16_LEN > helloSz)
Expand Down Expand Up @@ -7081,7 +7087,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 bdc1b19

Please sign in to comment.