From 01ead8590b5459393e6a87b5f591bce6fb8de8d3 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 20 Jul 2013 13:15:11 +0000 Subject: [PATCH] Another two mis-fixes from r9919: when we sfree(line) on exit from the ssh.com and OpenSSH key import loops, we should also null it out so that the cleanup path doesn't try to re-free the same pointer. [originally from svn r9944] [r9919 == ea301bdd9b892a5e70692f82f5c0b98bd585e775] --- import.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/import.c b/import.c index 32a1ac5d..f6dc2809 100644 --- a/import.c +++ b/import.c @@ -372,6 +372,7 @@ static struct openssh_key *load_openssh_key(const Filename *filename, if (0 == strncmp(line, "-----END ", 9) && 0 == strcmp(line+strlen(line)-16, "PRIVATE KEY-----")) { sfree(line); + line = NULL; break; /* done */ } if ((p = strchr(line, ':')) != NULL) { @@ -1095,6 +1096,7 @@ static struct sshcom_key *load_sshcom_key(const Filename *filename, strip_crlf(line); if (!strcmp(line, "---- END SSH2 ENCRYPTED PRIVATE KEY ----")) { sfree(line); + line = NULL; break; /* done */ } if ((p = strchr(line, ':')) != NULL) { -- 2.45.2