From 6b94e81622eae8dac0d0a88bb6f4b32fb82b037f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=CE=B6eh=20Matt?= <5415177+ZehMatt@users.noreply.github.com> Date: Sat, 31 Jul 2021 07:34:40 -0700 Subject: [PATCH] Fix dereferencing memory from a temporary object (#15137) --- src/openrct2/config/Config.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/openrct2/config/Config.cpp b/src/openrct2/config/Config.cpp index e29069d377..8e2a232172 100644 --- a/src/openrct2/config/Config.cpp +++ b/src/openrct2/config/Config.cpp @@ -739,7 +739,8 @@ namespace Config desc.filters[1].pattern = "*"; desc.filters[2].name = nullptr; - desc.initial_directory = Platform::GetFolderPath(SPECIAL_FOLDER::USER_HOME).c_str(); + const auto userHomePath = Platform::GetFolderPath(SPECIAL_FOLDER::USER_HOME); + desc.initial_directory = userHomePath.c_str(); return platform_open_common_file_dialog(installerPath, &desc, 4096); }