From bbbc14ea6b94eb71ce8cdb8334c6d4222c2d5c68 Mon Sep 17 00:00:00 2001 From: John Safranek Date: Fri, 1 Dec 2017 12:04:56 -0800 Subject: [PATCH] Bug Fixes 1. Fix an incorrect memory free when releasing a bad WOLFSSH object. 2. Pass correct context to the I/O Send Callback function. --- src/internal.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/internal.c b/src/internal.c index 36bbeea..4737b70 100644 --- a/src/internal.c +++ b/src/internal.c @@ -330,7 +330,7 @@ WOLFSSH* SshInit(WOLFSSH* ssh, WOLFSSH_CTX* ctx) WLOG(WS_LOG_DEBUG, "SshInit: Cannot allocate memory.\n"); WFREE(handshake, heap, DYNTYPE_HS); WFREE(rng, heap, DYNTYPE_RNG); - wolfSSH_free(ssh); + WFREE(ssh, heap, DYNTYPE_SSH); return NULL; } @@ -1177,7 +1177,7 @@ static int SendBuffered(WOLFSSH* ssh) while (ssh->outputBuffer.length > 0) { int sent = ssh->ctx->ioSendCb(ssh, ssh->outputBuffer.buffer + ssh->outputBuffer.idx, - ssh->outputBuffer.length, ssh->ioReadCtx); + ssh->outputBuffer.length, ssh->ioWriteCtx); if (sent < 0) { switch (sent) {