Skip to content

Commit

Permalink
Merge pull request #668 from ejohnstown/fix-modes-leak
Browse files Browse the repository at this point in the history
Fix Modes Leak
  • Loading branch information
JacobBarthelmeh authored Mar 14, 2024
2 parents f92b076 + e6ffad0 commit b798f63
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/internal.c
Original file line number Diff line number Diff line change
Expand Up @@ -1017,6 +1017,12 @@ void SshResourceFree(WOLFSSH* ssh, void* heap)
ssh->sftpDefaultPath = NULL;
}
#endif
#ifdef WOLFSSH_TERM
if (ssh->modes) {
WFREE(ssh->modes, ssh->ctx->heap, DYNTYPE_STRING);
ssh->modesSz = 0;
}
#endif
}


Expand Down Expand Up @@ -7584,7 +7590,8 @@ static int DoChannelRequest(WOLFSSH* ssh,
if (ret == WS_SUCCESS)
ret = GetStringRef(&modesSz, &modes, buf, len, &begin);
if (ret == WS_SUCCESS) {
ssh->modes = (byte*)WMALLOC(modesSz, ssh->ctx->heap, 0);
ssh->modes = (byte*)WMALLOC(modesSz,
ssh->ctx->heap, DYNTYPE_STRING);
if (ssh->modes == NULL)
ret = WS_MEMORY_E;
}
Expand Down

0 comments on commit b798f63

Please sign in to comment.