Fix writedup rng leak

This commit is contained in:
Eric Blankenhorn
2023-09-18 16:19:22 -05:00
parent 1149522357
commit 911c4519ef
2 changed files with 9 additions and 0 deletions

View File

@ -7934,6 +7934,8 @@ void SSL_ResourceFree(WOLFSSL* ssl)
if (ssl->options.weOwnRng) {
wc_FreeRng(ssl->rng);
XFREE(ssl->rng, ssl->heap, DYNAMIC_TYPE_RNG);
ssl->rng = NULL;
ssl->options.weOwnRng = 0;
}
FreeSuites(ssl);
FreeHandshakeHashes(ssl);

View File

@ -1563,6 +1563,13 @@ static int DupSSL(WOLFSSL* dup, WOLFSSL* ssl)
ssl->dupWrite->dupCount = 2; /* both sides have a count to start */
dup->dupWrite = ssl->dupWrite; /* each side uses */
if (dup->options.weOwnRng) {
wc_FreeRng(dup->rng);
XFREE(dup->rng, dup->heap, DYNAMIC_TYPE_RNG);
dup->rng = NULL;
dup->options.weOwnRng = 0;
}
/* copy write parts over to dup writer */
XMEMCPY(&dup->specs, &ssl->specs, sizeof(CipherSpecs));
XMEMCPY(&dup->options, &ssl->options, sizeof(Options));