mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-01 11:12:50 -05:00
kex-hybrid: fix a small memory leak on failure.
Spotted by Coverity: we've just allocated a strbuf to hold the output of the classical half of the hybrid key exchange, but if that output isn't generated due to some kind of failure, we forgot to free the strbuf on exit.
This commit is contained in:
parent
9ab416e018
commit
8fb45f4617
@ -146,6 +146,7 @@ static bool hybrid_client_getkey(ecdh_key *ek, ptrlen remoteKey, BinarySink *bs)
|
||||
if (!ecdh_key_getkey(s->classical, classical_data,
|
||||
BinarySink_UPCAST(classical_key))) {
|
||||
ssh_hash_free(h);
|
||||
strbuf_free(classical_key);
|
||||
return false; /* classical DH key didn't validate */
|
||||
}
|
||||
s->alg->reformat(ptrlen_from_strbuf(classical_key), BinarySink_UPCAST(h));
|
||||
@ -238,6 +239,7 @@ static bool hybrid_server_getkey(ecdh_key *ek, ptrlen remoteKey, BinarySink *bs)
|
||||
if (!ecdh_key_getkey(s->classical, classical_data,
|
||||
BinarySink_UPCAST(classical_key))) {
|
||||
ssh_hash_free(h);
|
||||
strbuf_free(classical_key);
|
||||
return false; /* classical DH key didn't validate */
|
||||
}
|
||||
s->alg->reformat(ptrlen_from_strbuf(classical_key), BinarySink_UPCAST(h));
|
||||
|
Loading…
x
Reference in New Issue
Block a user