From ac633679b4fd22ecf7514831f6926c9212ead7af Mon Sep 17 00:00:00 2001 From: Adeel Asghar Date: Tue, 15 Mar 2022 11:30:30 +0100 Subject: [PATCH] Make a duplicate of the environment value (#8703) Fixes #8686 --- OMCompiler/Compiler/runtime/settingsimpl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/OMCompiler/Compiler/runtime/settingsimpl.c b/OMCompiler/Compiler/runtime/settingsimpl.c index c00fd95c249..f069d38632b 100644 --- a/OMCompiler/Compiler/runtime/settingsimpl.c +++ b/OMCompiler/Compiler/runtime/settingsimpl.c @@ -347,10 +347,8 @@ extern const char* SettingsImpl__getTempDirectoryPath(void) fprintf(stderr, "Error setting temppath in Kernel\n"); exit(1); } else { - // Must do replacement in two steps, since the _replace function can not have similar source as target. - char *str = _replace(tempDirectory, (char*)"\\", (char*)"/"); - tempDirectoryPath = _replace(str, (char*)"/", (char*)"\\\\"); - GC_free(str); + tempDirectoryPath = strdup(tempDirectory); + tempDirectoryPath = covertToForwardSlashesInPlace(tempDirectoryPath); } #else const char* str = getenv("TMPDIR");