if a handshake info has a stored kex init message already before trying to store a kex init message, free it

pull/312/head
John Safranek 2021-01-26 17:36:15 -08:00
parent 3653afac34
commit c7a392d351
No known key found for this signature in database
GPG Key ID: 8CE817DE0D3CCB4A
1 changed files with 6 additions and 0 deletions

View File

@ -6352,6 +6352,12 @@ int SendKexInit(WOLFSSH* ssh)
ssh->outputBuffer.length = idx;
if (ssh->handshake->kexInit != NULL) {
WFREE(ssh->handshake->kexInit, ssh->ctx->heap, DYNTYPE_STRING);
ssh->handshake->kexInit = NULL;
ssh->handshake->kexInitSz = 0;
}
buf = (byte*)WMALLOC(bufSz, ssh->ctx->heap, DYNTYPE_STRING);
if (buf == NULL) {
WLOG(WS_LOG_DEBUG, "Cannot allocate storage for KEX Init msg");