Skip to content

Commit 5007cf0

Browse files
Change the cleanup phase
1 parent 1473a13 commit 5007cf0

1 file changed

Lines changed: 20 additions & 9 deletions

File tree

src/internal.c

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -15456,15 +15456,6 @@ int SendUserAuthKeyboardResponse(WOLFSSH* ssh)
1545615456
WLOG(WS_LOG_DEBUG, "SUAR: Calling the userauth callback");
1545715457
authRet = ssh->ctx->userAuthCb(WOLFSSH_USERAUTH_KEYBOARD, &authData,
1545815458
ssh->userAuthCtx);
15459-
15460-
WFREE(ssh->kbAuth.promptName, ssh->ctx->heap, 0);
15461-
WFREE(ssh->kbAuth.promptInstruction, ssh->ctx->heap, 0);
15462-
WFREE(ssh->kbAuth.promptLanguage, ssh->ctx->heap, 0);
15463-
WFREE(ssh->kbAuth.promptEcho, ssh->ctx->heap, 0);
15464-
for (prompt = 0; prompt < ssh->kbAuth.promptCount; prompt++) {
15465-
WFREE((void*)ssh->kbAuth.prompts[prompt], ssh->ctx->heap, 0);
15466-
}
15467-
WFREE(ssh->kbAuth.prompts, ssh->ctx->heap, 0);
1546815459
}
1546915460

1547015461
if (ret == WS_SUCCESS) {
@@ -15482,6 +15473,26 @@ int SendUserAuthKeyboardResponse(WOLFSSH* ssh)
1548215473
}
1548315474
}
1548415475

15476+
if (ssh != NULL && ssh->ctx != NULL) {
15477+
WFREE(ssh->kbAuth.promptName, ssh->ctx->heap, 0);
15478+
WFREE(ssh->kbAuth.promptInstruction, ssh->ctx->heap, 0);
15479+
WFREE(ssh->kbAuth.promptLanguage, ssh->ctx->heap, 0);
15480+
WFREE(ssh->kbAuth.promptEcho, ssh->ctx->heap, 0);
15481+
if (ssh->kbAuth.prompts != NULL) {
15482+
for (prompt = 0; prompt < ssh->kbAuth.promptCount; prompt++) {
15483+
WFREE((void*)ssh->kbAuth.prompts[prompt], ssh->ctx->heap, 0);
15484+
}
15485+
}
15486+
WFREE(ssh->kbAuth.prompts, ssh->ctx->heap, 0);
15487+
15488+
ssh->kbAuth.promptName = NULL;
15489+
ssh->kbAuth.promptInstruction = NULL;
15490+
ssh->kbAuth.promptLanguage = NULL;
15491+
ssh->kbAuth.promptEcho = NULL;
15492+
ssh->kbAuth.prompts = NULL;
15493+
ssh->kbAuth.promptCount = 0;
15494+
}
15495+
1548515496
payloadSz = MSG_ID_SZ;
1548615497

1548715498
if (ret == WS_SUCCESS) {

0 commit comments

Comments
 (0)