1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Fix a null-dereference introduced by another mis-fix in r9919.

[originally from svn r9946]
[r9919 == ea301bdd9b]
This commit is contained in:
Simon Tatham 2013-07-20 13:15:20 +00:00
parent adf8b3222f
commit 1073d229ae

View File

@ -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;
}