-
Notifications
You must be signed in to change notification settings - Fork 565
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tls_wolfssl: patch wolfssl lib to fix memory leak
More information about the leak can be found on the wolfssl issue tracker: wolfSSL/wolfssl#6760 (cherry picked from commit 716f1d6)
- Loading branch information
1 parent
93b2594
commit cf45a66
Showing
3 changed files
with
40 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/*.patched |
30 changes: 30 additions & 0 deletions
30
modules/tls_wolfssl/lib/patches/wolfssl-internal-memleak-fix.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
diff --git a/src/internal.c b/src/internal.c | ||
index 930769152..8e7ccf9c4 100644 | ||
--- a/src/internal.c | ||
+++ b/src/internal.c | ||
@@ -7207,7 +7208,11 @@ void SSL_ResourceFree(WOLFSSL* ssl) | ||
/* Cleanup async */ | ||
FreeAsyncCtx(ssl, 1); | ||
#endif | ||
- if (ssl->options.weOwnRng) { | ||
+ if (ssl->options.weOwnRng || (ssl->rng | ||
+#ifdef SINGLE_THREADED | ||
+ && ssl->rng != ssl->ctx->rng | ||
+#endif | ||
+ )) { | ||
wc_FreeRng(ssl->rng); | ||
XFREE(ssl->rng, ssl->heap, DYNAMIC_TYPE_RNG); | ||
} | ||
@@ -7571,7 +7576,11 @@ void FreeHandshakeResources(WOLFSSL* ssl) | ||
#endif | ||
#endif | ||
) { | ||
- if (ssl->options.weOwnRng) { | ||
+ if (ssl->options.weOwnRng || (ssl->rng | ||
+#ifdef SINGLE_THREADED | ||
+ && ssl->rng != ssl->ctx->rng | ||
+#endif | ||
+ )) { | ||
wc_FreeRng(ssl->rng); | ||
XFREE(ssl->rng, ssl->heap, DYNAMIC_TYPE_RNG); | ||
ssl->rng = NULL; |