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