mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-25 01:02:24 +00:00
Fix a few memory leaks.
Patch due to Chris Staite.
This commit is contained in:
parent
84e239dd88
commit
78989c97c9
2
ssh.c
2
ssh.c
@ -9538,6 +9538,8 @@ static void do_ssh2_authconn(Ssh ssh, unsigned char *in, int inlen,
|
|||||||
logevent("Sent public key signature");
|
logevent("Sent public key signature");
|
||||||
s->type = AUTH_TYPE_PUBLICKEY;
|
s->type = AUTH_TYPE_PUBLICKEY;
|
||||||
key->alg->freekey(key->data);
|
key->alg->freekey(key->data);
|
||||||
|
sfree(key->comment);
|
||||||
|
sfree(key);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef NO_GSSAPI
|
#ifndef NO_GSSAPI
|
||||||
|
@ -843,7 +843,7 @@ unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
|
|||||||
int public_blob_len;
|
int public_blob_len;
|
||||||
int i;
|
int i;
|
||||||
const char *error = NULL;
|
const char *error = NULL;
|
||||||
char *comment;
|
char *comment = NULL;
|
||||||
|
|
||||||
public_blob = NULL;
|
public_blob = NULL;
|
||||||
|
|
||||||
@ -868,11 +868,10 @@ unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
|
|||||||
goto error;
|
goto error;
|
||||||
/* Select key algorithm structure. */
|
/* Select key algorithm structure. */
|
||||||
alg = find_pubkey_alg(b);
|
alg = find_pubkey_alg(b);
|
||||||
|
sfree(b);
|
||||||
if (!alg) {
|
if (!alg) {
|
||||||
sfree(b);
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
sfree(b);
|
|
||||||
|
|
||||||
/* Read the Encryption header line. */
|
/* Read the Encryption header line. */
|
||||||
if (!read_header(fp, header) || 0 != strcmp(header, "Encryption"))
|
if (!read_header(fp, header) || 0 != strcmp(header, "Encryption"))
|
||||||
@ -919,6 +918,10 @@ unsigned char *ssh2_userkey_loadpub(const Filename *filename, char **algorithm,
|
|||||||
sfree(public_blob);
|
sfree(public_blob);
|
||||||
if (errorstr)
|
if (errorstr)
|
||||||
*errorstr = error;
|
*errorstr = error;
|
||||||
|
if (comment && commentptr) {
|
||||||
|
sfree(comment);
|
||||||
|
*commentptr = NULL;
|
||||||
|
}
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user