1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-07-03 20:42:48 -05:00

Joe Yates's memory leak patches.

[originally from svn r3650]
This commit is contained in:
Simon Tatham
2003-12-19 12:44:46 +00:00
parent 20bc740780
commit 7a1eae7ff2
10 changed files with 118 additions and 8 deletions

38
ssh.c
View File

@ -2535,6 +2535,22 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen, int ispkt)
ssh->crcda_ctx = crcda_make_context();
logevent("Installing CRC compensation attack detector");
if (servkey.modulus) {
sfree(servkey.modulus);
servkey.modulus = NULL;
}
if (servkey.exponent) {
sfree(servkey.exponent);
servkey.exponent = NULL;
}
if (hostkey.modulus) {
sfree(hostkey.modulus);
hostkey.modulus = NULL;
}
if (hostkey.exponent) {
sfree(hostkey.exponent);
hostkey.exponent = NULL;
}
crWaitUntil(ispkt);
if (ssh->pktin.type != SSH1_SMSG_SUCCESS) {
@ -3037,6 +3053,7 @@ static int do_ssh1_login(Ssh ssh, unsigned char *in, int inlen, int ispkt)
}
logevent("Sending password with camouflage packets");
ssh_pkt_defersend(ssh);
sfree(randomstr);
}
else if (!(ssh->remote_bugs & BUG_NEEDS_SSH1_PLAIN_PASSWORD)) {
/*
@ -4338,6 +4355,10 @@ static int do_ssh2_transport(Ssh ssh, unsigned char *in, int inlen, int ispkt)
if (ssh->sccomp->text_name)
logeventf(ssh, "Initialised %s decompression",
ssh->sccomp->text_name);
freebn(s->f);
freebn(s->g);
freebn(s->K);
freebn(s->p);
/*
* If this is the first key exchange phase, we must pass the
@ -6278,7 +6299,22 @@ static void ssh_free(void *handle)
sfree(ssh->do_ssh1_login_state);
sfree(ssh->do_ssh2_transport_state);
sfree(ssh->do_ssh2_authconn_state);
if (ssh->pktout.data) {
sfree(ssh->pktout.data);
ssh->pktout.data = NULL;
}
if (ssh->pktin.data) {
sfree(ssh->pktin.data);
ssh->pktin.data = NULL;
}
if (ssh->crcda_ctx) {
crcda_free_context(ssh->crcda_ctx);
ssh->crcda_ctx = NULL;
}
if (ssh->logctx) {
log_free(ssh->logctx);
ssh->logctx = NULL;
}
if (ssh->s)
ssh_do_close(ssh);
sfree(ssh);