| 257 | } |
| 258 | |
| 259 | dmtcp::string |
| 260 | jalib::Filesystem::GetProgramPath() |
| 261 | { |
| 262 | static dmtcp::string *value = NULL; |
| 263 | if (value == NULL) { |
| 264 | // Technically, this is a memory leak, but value is static and so it happens |
| 265 | // only once. |
| 266 | value = new (JALLOC_MALLOC(sizeof(dmtcp::string))) dmtcp::string(_GetProgramExe()); |
| 267 | } |
| 268 | return *value; |
| 269 | } |
| 270 | |
| 271 | // NOTE: ResolveSymlink returns a string, buf, allocated on the stack. |
| 272 | // While this is dangerous, it avoids the use of malloc or 'new'. |
nothing calls this directly
no test coverage detected