diff --git a/examples/echoserver/echoserver.c b/examples/echoserver/echoserver.c index b92c816a..99660543 100644 --- a/examples/echoserver/echoserver.c +++ b/examples/echoserver/echoserver.c @@ -746,6 +746,7 @@ THREAD_RETURN WOLFSSH_THREAD echoserver_test(void* args) ssh = wolfSSH_new(ctx); if (ssh == NULL) { + free(threadCtx); fprintf(stderr, "Couldn't allocate SSH data.\n"); exit(EXIT_FAILURE); } diff --git a/tests/unit.c b/tests/unit.c index 822a8eb4..e43e0e61 100644 --- a/tests/unit.c +++ b/tests/unit.c @@ -317,7 +317,7 @@ static int test_KDF(void) byte* h = NULL; byte* sId = NULL; byte* eKey = NULL; - word32 kSz, hSz, sIdSz, eKeySz; + word32 kSz = 0, hSz = 0, sIdSz = 0, eKeySz = 0; byte cKey[32]; /* Greater of SHA256_DIGEST_SIZE and AES_BLOCK_SIZE */ /* sId - Session ID, eKey - Expected Key, cKey - Calculated Key */ @@ -347,6 +347,10 @@ static int test_KDF(void) } FreeBins(k, h, sId, eKey); + k = NULL; + h = NULL; + sId = NULL; + eKey = NULL; if (result != 0) break; }