From 88d4e5475d6541f8cc1bf5ddda81f2755ec06ba4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20Fr=C3=BChwirth?= Date: Fri, 4 May 2018 18:04:33 +0200 Subject: [PATCH] PSP: Fix UB (use of deallocated memory) --- backends/saves/psp/psp-saves.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backends/saves/psp/psp-saves.cpp b/backends/saves/psp/psp-saves.cpp index 9d9affbc1b0d..ba09223884ea 100644 --- a/backends/saves/psp/psp-saves.cpp +++ b/backends/saves/psp/psp-saves.cpp @@ -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);