From b70f22e21a13fd49f2c2f5344c69a5dfdfbfab05 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Thu, 12 Sep 2019 16:02:36 -0700 Subject: [PATCH] 1. Use the session deallocator on the deserialized session in the client. 2. Free the flatten session if the size check fails. --- examples/client/client.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/client/client.c b/examples/client/client.c index ef0b16977..33f28f061 100644 --- a/examples/client/client.c +++ b/examples/client/client.c @@ -2997,8 +2997,10 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) int checkSz = wolfSSL_i2d_SSL_SESSION(session, &flatSession); if (flatSession == NULL) err_sys("error creating flattened session buffer"); - if (checkSz != flatSessionSz) + if (checkSz != flatSessionSz) { + XFREE(flatSession, NULL, DYNAMIC_TYPE_TMP_BUFFER); err_sys("flat session size check failure"); + } } } #endif @@ -3090,7 +3092,7 @@ THREAD_RETURN WOLFSSL_THREAD client_test(void* args) #if defined(OPENSSL_EXTRA) && defined(HAVE_EXT_CACHE) if (flatSession) { XFREE(flatSession, heap, DYNAMIC_TYPE_TMP_BUFFER); - XFREE(session, heap, DYNAMIC_TYPE_OPENSSL); + wolfSSL_SESSION_free(session); } #endif #ifdef HAVE_SESSION_TICKET