Skip to content

Commit 8c85b44

Browse files
committed
Fix oms::XercesValidator::getExecutablePath (#1353)
1 parent 3c0bf3b commit 8c85b44

3 files changed

Lines changed: 7 additions & 15 deletions

File tree

src/OMSimulatorLib/XercesValidator.cpp

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -95,29 +95,19 @@ oms::XercesValidator::~XercesValidator()
9595

9696
std::string oms::XercesValidator::getExecutablePath()
9797
{
98-
std::string executablePath = "";
99-
10098
int dirname_length;
10199
int length = wai_getModulePath(NULL, 0, &dirname_length);
102100

103101
if (length == 0)
104-
logError("executable directory name could not be detected");
105-
106-
char * path;
107-
path = (char*)malloc(length + 1);
102+
logError("Path to the current module could not be detected.");
108103

109-
if (!path)
110-
logError("Could not allocate memory to path");
104+
char* path = (char*)malloc(length + 1);
111105

112-
wai_getModulePath(path, length, &dirname_length);
113-
path[length] = '\0';
106+
if (wai_getModulePath(path, length, &dirname_length) == 0)
107+
logError("Path to the current module could not be detected.");
114108

115-
//std::cout << "executable path: " << path << "\n";
116109
path[dirname_length] = '\0';
117-
//std::cout << "dirname: "<< path << "\n";
118-
//std::cout << "basename: "<< path + dirname_length + 1;
119-
120-
executablePath = oms::allocateAndCopyString(path);
110+
std::string executablePath = path;
121111
free(path);
122112

123113
return executablePath;

testsuite/api/deleteResourcesInSSP1.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
-- ucrt64: yes
55
-- win: yes
66
-- mac: no
7+
-- asan: yes
78

89
oms_setCommandLineOption("--suppressPath=true")
910
oms_setTempDirectory("./deleteResources1_lua/")

testsuite/simulation/addResources1.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
-- ucrt64: yes
55
-- win: yes
66
-- mac: no
7+
-- asan: yes
78

89
oms_setCommandLineOption("--suppressPath=true")
910
oms_setTempDirectory("./addResources1_lua/")

0 commit comments

Comments
 (0)