aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source/Host/freebsd/HostInfoFreeBSD.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/source/Host/freebsd/HostInfoFreeBSD.cpp b/source/Host/freebsd/HostInfoFreeBSD.cpp
index e28cf4aa4..eeaf22276 100644
--- a/source/Host/freebsd/HostInfoFreeBSD.cpp
+++ b/source/Host/freebsd/HostInfoFreeBSD.cpp
@@ -64,13 +64,10 @@ FileSpec HostInfoFreeBSD::GetProgramFileSpec() {
static FileSpec g_program_filespec;
if (!g_program_filespec) {
int exe_path_mib[4] = {CTL_KERN, KERN_PROC, KERN_PROC_PATHNAME, getpid()};
- size_t exe_path_size;
- if (sysctl(exe_path_mib, 4, NULL, &exe_path_size, NULL, 0) == 0) {
- char *exe_path = new char[exe_path_size];
- if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
- g_program_filespec.SetFile(exe_path, FileSpec::Style::native);
- delete[] exe_path;
- }
+ char exe_path[PATH_MAX];
+ size_t exe_path_size = sizeof(exe_path);
+ if (sysctl(exe_path_mib, 4, exe_path, &exe_path_size, NULL, 0) == 0)
+ g_program_filespec.SetFile(exe_path, false);
}
return g_program_filespec;
}