From af0103bc9470a0bfe010046653e197f8fc686af4 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 27 Apr 2017 13:23:33 -0700 Subject: [PATCH] =?UTF-8?q?Fix=20for=20Valgrind=20memory=20leak=20with=20t?= =?UTF-8?q?he=20=E2=80=9Cssl->hsHashes=E2=80=9D.=20The=20DTLS=20wolfSSL=5F?= =?UTF-8?q?connect=20for=20=E2=80=9CIsDtlsNotSctpMode=E2=80=9D=20at=20line?= =?UTF-8?q?=208134=20calls=20InitHandshakeHashes,=20but=20doesn=E2=80=99t?= =?UTF-8?q?=20free=20existing.=20Best=20overall=20solution=20is=20to=20mak?= =?UTF-8?q?e=20sure=20and=20free=20an=20existing=20on=20InitHandshakeHashe?= =?UTF-8?q?s,=20since=20WOLFSSL=20is=20memset=20to=200.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/internal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/internal.c b/src/internal.c index 1cc38d5328..25fa2ac487 100755 --- a/src/internal.c +++ b/src/internal.c @@ -3399,6 +3399,12 @@ int InitHandshakeHashes(WOLFSSL* ssl) { int ret; + /* make sure existing handshake hashes are free'd */ + if (ssl->hsHashes != NULL) { + FreeHandshakeHashes(ssl); + } + + /* allocate handshake hashes */ ssl->hsHashes = (HS_Hashes*)XMALLOC(sizeof(HS_Hashes), ssl->heap, DYNAMIC_TYPE_HASHES); if (ssl->hsHashes == NULL) {