Add PacketPurge to a couple of Send functions that can error out between Prepare and BundlePacket.

pull/337/head
John Safranek 2021-05-04 14:06:36 -07:00
parent 35616ada1d
commit 9ae319fc24
No known key found for this signature in database
GPG Key ID: 8CE817DE0D3CCB4A
1 changed files with 6 additions and 0 deletions

View File

@ -7250,6 +7250,9 @@ int SendKexDhReply(WOLFSSH* ssh)
if (ret == WS_SUCCESS)
ret = SendNewKeys(ssh);
if (ret != WS_WANT_WRITE && ret != WS_SUCCESS)
PurgePacket(ssh);
WLOG(WS_LOG_DEBUG, "Leaving SendKexDhReply(), ret = %d", ret);
#ifdef WOLFSSH_SMALL_STACK
if (sigKeyBlock_ptr)
@ -8612,6 +8615,9 @@ int SendUserAuthRequest(WOLFSSH* ssh, byte authId, int addSig)
if (ret == WS_SUCCESS)
ret = wolfSSH_SendPacket(ssh);
if (ret != WS_WANT_WRITE && ret != WS_SUCCESS)
PurgePacket(ssh);
ForceZero(&authData, sizeof(WS_UserAuthData));
WLOG(WS_LOG_DEBUG, "Leaving SendUserAuthRequest(), ret = %d", ret);
#ifdef WOLFSSH_SMALL_STACK