diff options
author | anonimal <anonimal@getmonero.org> | 2019-09-06 23:11:37 +0000 |
---|---|---|
committer | anonimal <anonimal@getmonero.org> | 2019-09-06 23:11:37 +0000 |
commit | 1bd962d9f9037ed20fdf588d3b91ce36567f4867 (patch) | |
tree | 8dee203b6ff7a1dee17041e6333de09c40be1d45 /src/wallet | |
parent | epee: connection_basic: resolve CID 203920 (UNINIT_CTOR) (diff) | |
download | monero-1bd962d9f9037ed20fdf588d3b91ce36567f4867.tar.xz |
wallet2: resolve CID 203918 null pointer deference (NULL_RETURNS)
Diffstat (limited to 'src/wallet')
-rw-r--r-- | src/wallet/wallet2.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/wallet/wallet2.cpp b/src/wallet/wallet2.cpp index b99fc12e2..009a0441f 100644 --- a/src/wallet/wallet2.cpp +++ b/src/wallet/wallet2.cpp @@ -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+"); + 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. int write_result = PEM_write(fp, ASCII_OUTPUT_MAGIC.c_str(), "", (const unsigned char *) raw.c_str(), raw.length()); fclose(fp); |