Skip to content

Commit

Permalink
Merge pull request wolfSSL#626 from ejohnstown/unused-heap
Browse files Browse the repository at this point in the history
Unused Heap
  • Loading branch information
JacobBarthelmeh authored Dec 1, 2023
2 parents 0c6d34f + 72888da commit 0a49c5f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/agent.c
Original file line number Diff line number Diff line change
Expand Up @@ -1553,7 +1553,7 @@ void wolfSSH_AGENT_ID_free(WOLFSSH_AGENT_ID* id, void* heap)
WFREE(id->keyBuffer, heap, DYNTYPE_STRING);
}
WMEMSET(id, 0, sizeof(WOLFSSH_AGENT_ID));
WFREE(id, heap, DYNATYPE_AGENT_ID);
WFREE(id, heap, DYNTYPE_AGENT_ID);
}

WLOG(WS_LOG_AGENT, "Leaving wolfSSH_AGENT_ID_free()");
Expand Down
10 changes: 6 additions & 4 deletions src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1516,7 +1516,7 @@ static int SetHostCertificate(WOLFSSH_CTX* ctx,

if (pvtKey->publicKeyFmt == certId) {
if (pvtKey->cert != NULL) {
WFREE(pvtKey->cert, heap, dynamicType);
WFREE(pvtKey->cert, ctx->heap, dynamicType);
}
}
else {
Expand Down Expand Up @@ -2210,17 +2210,19 @@ int ChannelUpdateForward(WOLFSSH_CHANNEL* channel,
const char* origin, word32 originPort,
int isDirect)
{
void* heap = NULL;
int ret = WS_SUCCESS;
char* hostCopy = NULL;
char* originCopy = NULL;
word32 hostSz;
word32 originSz;

WOLFSSH_UNUSED(heap);

if (channel == NULL || host == NULL || origin == NULL)
ret = WS_BAD_ARGUMENT;
else {
void* heap = channel->ssh->ctx->heap;

heap = channel->ssh->ctx->heap;
hostSz = (word32)WSTRLEN(host) + 1;
originSz = (word32)WSTRLEN(origin) + 1;
hostCopy = (char*)WMALLOC(hostSz, heap, DYNTYPE_STRING);
Expand Down Expand Up @@ -5614,7 +5616,7 @@ static int DoUserAuthRequestRsa(WOLFSSH* ssh, WS_UserAuthData_PublicKey* pk,
if (checkDigest)
WFREE(checkDigest, ssh->ctx->heap, DYNTYPE_BUFFER);
if (encDigest)
WFREE(encDigest, ssh->ctx_heap, DYNTYPE_BUFFER);
WFREE(encDigest, ssh->ctx->heap, DYNTYPE_BUFFER);
#endif
WLOG(WS_LOG_DEBUG, "Leaving DoUserAuthRequestRsa(), ret = %d", ret);
return ret;
Expand Down

0 comments on commit 0a49c5f

Please sign in to comment.