fix memory leaks

This commit is contained in:
John Bland
2023-09-26 14:29:13 -04:00
parent bc77f9f466
commit 4c63ec3fce
2 changed files with 8 additions and 0 deletions

View File

@@ -7993,6 +7993,11 @@ void SSL_ResourceFree(WOLFSSL* ssl)
} }
FreeSuites(ssl); FreeSuites(ssl);
FreeHandshakeHashes(ssl); FreeHandshakeHashes(ssl);
#ifdef HAVE_ECH
/* try to free the ech hashes in case we errored out */
ssl->hsHashes = ssl->hsHashesEch;
FreeHandshakeHashes(ssl);
#endif
XFREE(ssl->buffers.domainName.buffer, ssl->heap, DYNAMIC_TYPE_DOMAIN); XFREE(ssl->buffers.domainName.buffer, ssl->heap, DYNAMIC_TYPE_DOMAIN);
/* clear keys struct after session */ /* clear keys struct after session */

View File

@@ -11808,6 +11808,9 @@ static int TLSX_ECH_Parse(WOLFSSL* ssl, const byte* readBuf, word16 size,
/* set the ech payload of the copy to zeros */ /* set the ech payload of the copy to zeros */
XMEMSET(aadCopy + (readBuf_p - ech->aad), 0, XMEMSET(aadCopy + (readBuf_p - ech->aad), 0,
ech->innerClientHelloLen + AES_BLOCK_SIZE); ech->innerClientHelloLen + AES_BLOCK_SIZE);
/* free the old ech in case this is our second client hello */
if (ech->innerClientHello != NULL)
XFREE(ech->innerClientHello, ssl->heap, DYNAMIC_TYPE_TMP_BUFFER);
/* allocate the inner payload buffer */ /* allocate the inner payload buffer */
ech->innerClientHello = ech->innerClientHello =
(byte*)XMALLOC(ech->innerClientHelloLen + HANDSHAKE_HEADER_SZ, (byte*)XMALLOC(ech->innerClientHelloLen + HANDSHAKE_HEADER_SZ,