PSP: Fix UB (use of deallocated memory)

This commit is contained in:
Adrian Frühwirth 2018-05-04 18:04:33 +02:00
parent 47ecb0b2e7
commit 88d4e5475d

View file

@ -60,16 +60,15 @@ PSPSaveFileManager::PSPSaveFileManager(const Common::String &defaultSavepath)
*/
void PSPSaveFileManager::checkPath(const Common::FSNode &dir) {
const char *savePath = dir.getPath().c_str();
clearError();
PowerMan.beginCriticalSection();
//check if the save directory exists
SceUID fd = sceIoDopen(savePath);
SceUID fd = sceIoDopen(dir.getPath().c_str());
if (fd < 0) {
//No? then let's create it.
sceIoMkdir(savePath, 0777);
sceIoMkdir(dir.getPath().c_str(), 0777);
} else {
//it exists, so close it again.
sceIoDclose(fd);