mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 09:58:01 +00:00
Fix memory leak in rsa_ssh1_savekey.
The strbuf containing the data of the output key file was never freed.
This commit is contained in:
parent
6e7df89316
commit
85b1916ca6
@ -371,13 +371,14 @@ bool rsa_ssh1_savekey(const Filename *filename, RSAKey *key,
|
|||||||
* Done. Write the result to the file.
|
* Done. Write the result to the file.
|
||||||
*/
|
*/
|
||||||
fp = f_open(filename, "wb", true);
|
fp = f_open(filename, "wb", true);
|
||||||
|
bool ret = false;
|
||||||
if (fp) {
|
if (fp) {
|
||||||
bool ret = (fwrite(buf->u, 1, buf->len, fp) == (size_t) (buf->len));
|
ret = (fwrite(buf->u, 1, buf->len, fp) == (size_t) (buf->len));
|
||||||
if (fclose(fp))
|
if (fclose(fp))
|
||||||
ret = false;
|
ret = false;
|
||||||
|
}
|
||||||
|
strbuf_free(buf);
|
||||||
return ret;
|
return ret;
|
||||||
} else
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
Loading…
Reference in New Issue
Block a user