Fix leak of 'fname' introduced by the rewrite of write_random_seed in
[sgt/putty] / import.c
index 77a3243..f6dc280 100644 (file)
--- 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) {
@@ -1474,9 +1476,11 @@ struct ssh2_userkey *sshcom_read(const Filename *filename, char *passphrase,
         pos += put_mp(blob+pos, u.start, u.bytes);
         privlen = pos - publen;
     } else {
-        assert(type == DSA); /* the only other option from the if above */
         struct mpint_pos p, q, g, x, y;
         int pos = 4;
+
+        assert(type == DSA); /* the only other option from the if above */
+
         if (GET_32BIT(ciphertext) != 0) {
             errmsg = "predefined DSA parameters not supported";
             goto error;