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.
pull/45/head
John Safranek 2017-12-01 12:04:56 -08:00
parent fe3f19190e
commit bbbc14ea6b
1 changed files with 2 additions and 2 deletions

View File

@ -330,7 +330,7 @@ WOLFSSH* SshInit(WOLFSSH* ssh, WOLFSSH_CTX* ctx)
WLOG(WS_LOG_DEBUG, "SshInit: Cannot allocate memory.\n"); WLOG(WS_LOG_DEBUG, "SshInit: Cannot allocate memory.\n");
WFREE(handshake, heap, DYNTYPE_HS); WFREE(handshake, heap, DYNTYPE_HS);
WFREE(rng, heap, DYNTYPE_RNG); WFREE(rng, heap, DYNTYPE_RNG);
wolfSSH_free(ssh); WFREE(ssh, heap, DYNTYPE_SSH);
return NULL; return NULL;
} }
@ -1177,7 +1177,7 @@ static int SendBuffered(WOLFSSH* ssh)
while (ssh->outputBuffer.length > 0) { while (ssh->outputBuffer.length > 0) {
int sent = ssh->ctx->ioSendCb(ssh, int sent = ssh->ctx->ioSendCb(ssh,
ssh->outputBuffer.buffer + ssh->outputBuffer.idx, ssh->outputBuffer.buffer + ssh->outputBuffer.idx,
ssh->outputBuffer.length, ssh->ioReadCtx); ssh->outputBuffer.length, ssh->ioWriteCtx);
if (sent < 0) { if (sent < 0) {
switch (sent) { switch (sent) {