From: simon Date: Sat, 20 Jul 2013 13:15:20 +0000 (+0000) Subject: Fix a null-dereference introduced by another mis-fix in r9919. X-Git-Url: https://git.distorted.org.uk/~mdw/sgt/putty/commitdiff_plain/c16e353eb95120407b78602f0bbaedac57eccf44 Fix a null-dereference introduced by another mis-fix in r9919. git-svn-id: svn://svn.tartarus.org/sgt/putty@9946 cda61777-01e9-0310-a592-d414129be87e --- diff --git a/import.c b/import.c index f6dc2809..bc35a4ab 100644 --- a/import.c +++ b/import.c @@ -1247,11 +1247,15 @@ int sshcom_encrypted(const Filename *filename, char **comment) answer = 1; done: - *comment = dupstr(key ? key->comment : ""); - smemclr(key->keyblob, key->keyblob_size); - sfree(key->keyblob); - smemclr(key, sizeof(*key)); - sfree(key); + if (key) { + *comment = dupstr(key->comment); + smemclr(key->keyblob, key->keyblob_size); + sfree(key->keyblob); + smemclr(key, sizeof(*key)); + sfree(key); + } else { + *comment = dupstr(""); + } return answer; }