aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrgad Shaneh2019-07-06 23:19:42 +0300
committerFilippos Karapetis2019-07-07 14:16:46 +0300
commit35c2f9ade51451de8dc88477500b82cfe69f2a5f (patch)
tree463bfff12f9de58b3affcf9c0e66bb5d7230eacd
parentd8cb826b1951e08d04fb3a790daf0e4a62db114c (diff)
downloadscummvm-rg350-35c2f9ade51451de8dc88477500b82cfe69f2a5f.tar.gz
scummvm-rg350-35c2f9ade51451de8dc88477500b82cfe69f2a5f.tar.bz2
scummvm-rg350-35c2f9ade51451de8dc88477500b82cfe69f2a5f.zip
BACKENDS: Fix crash when save file is owned by another user
fopen() fails, but the null handle was passed on to OutSaveFile.
-rw-r--r--backends/saves/default/default-saves.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/backends/saves/default/default-saves.cpp b/backends/saves/default/default-saves.cpp
index 8973101a5a..44fd48bb7e 100644
--- a/backends/saves/default/default-saves.cpp
+++ b/backends/saves/default/default-saves.cpp
@@ -169,6 +169,8 @@ Common::OutSaveFile *DefaultSaveFileManager::openForSaving(const Common::String
// Open the file for saving.
Common::WriteStream *const sf = fileNode.createWriteStream();
+ if (!sf)
+ return nullptr;
Common::OutSaveFile *const result = new Common::OutSaveFile(compress ? Common::wrapCompressedWriteStream(sf) : sf);
// Add file to cache now that it exists.