From 69802ed1a97b33bf483e9ee809a0360f9f231c84 Mon Sep 17 00:00:00 2001 From: Juliusz Sosinowicz Date: Tue, 9 Jun 2020 15:33:17 +0200 Subject: [PATCH] Missing ssl->heap in FreeBuildMsgArgs --- src/internal.c | 10 +++++----- wolfssl/internal.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/internal.c b/src/internal.c index 0c749d9f7..2789ad57b 100644 --- a/src/internal.c +++ b/src/internal.c @@ -6183,7 +6183,7 @@ void FreeKeyExchange(WOLFSSL* ssl) ssl->async.freeArgs(ssl, ssl->async.args); ssl->async.freeArgs = NULL; } - FreeBuildMsgArgs(&ssl->async.buildArgs); + FreeBuildMsgArgs(ssl, &ssl->async.buildArgs); #endif } @@ -16072,11 +16072,11 @@ int BuildCertHashes(WOLFSSL* ssl, Hashes* hashes) } #ifndef WOLFSSL_NO_TLS12 -void FreeBuildMsgArgs(BuildMsgArgs* args) +void FreeBuildMsgArgs(WOLFSSL* ssl, BuildMsgArgs* args) { if (args) { - if (args->iv) - XFREE(args->iv, NULL, DYNAMIC_TYPE_SALT); + if (ssl && args->iv) + XFREE(args->iv, ssl->heap, DYNAMIC_TYPE_SALT); XMEMSET(args, 0, sizeof(BuildMsgArgs)); } } @@ -16516,7 +16516,7 @@ exit_buildmsg: ret = args->sz; /* Final cleanup */ - FreeBuildMsgArgs(args); + FreeBuildMsgArgs(ssl, args); return ret; #endif /* !WOLFSSL_NO_TLS12 */ diff --git a/wolfssl/internal.h b/wolfssl/internal.h index 1fdcc69d4..304ed443b 100644 --- a/wolfssl/internal.h +++ b/wolfssl/internal.h @@ -4616,7 +4616,7 @@ WOLFSSL_LOCAL void FreeHandshakeHashes(WOLFSSL* ssl); #ifndef WOLFSSL_NO_TLS12 -WOLFSSL_LOCAL void FreeBuildMsgArgs(BuildMsgArgs* args); +WOLFSSL_LOCAL void FreeBuildMsgArgs(WOLFSSL* ssl, BuildMsgArgs* args); #endif WOLFSSL_LOCAL int BuildMessage(WOLFSSL* ssl, byte* output, int outSz, const byte* input, int inSz, int type, int hashOutput,