mirror of
https://github.com/monero-project/monero.git
synced 2024-11-17 16:27:39 +00:00
wallet2: resolve CID 203918 null pointer deference (NULL_RETURNS)
This commit is contained in:
parent
3a816398b3
commit
1bd962d9f9
1 changed files with 6 additions and 0 deletions
|
@ -13143,6 +13143,12 @@ bool wallet2::save_to_file(const std::string& path_to_file, const std::string& r
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *fp = fopen(path_to_file.c_str(), "w+");
|
FILE *fp = fopen(path_to_file.c_str(), "w+");
|
||||||
|
if (!fp)
|
||||||
|
{
|
||||||
|
MERROR("Failed to open wallet file for writing: " << path_to_file << ": " << strerror(errno));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
// Save the result b/c we need to close the fp before returning success/failure.
|
// Save the result b/c we need to close the fp before returning success/failure.
|
||||||
int write_result = PEM_write(fp, ASCII_OUTPUT_MAGIC.c_str(), "", (const unsigned char *) raw.c_str(), raw.length());
|
int write_result = PEM_write(fp, ASCII_OUTPUT_MAGIC.c_str(), "", (const unsigned char *) raw.c_str(), raw.length());
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
Loading…
Reference in a new issue