summaryrefslogtreecommitdiffstats
path: root/openbsd
diff options
context:
space:
mode:
authorMichael McConville <mmcco@mykolab.com>2016-01-02 17:11:23 -0500
committerMichael McConville <mmcco@mykolab.com>2016-01-02 17:11:23 -0500
commit3da36bbc61dbd27f717188a0a742bb637ca4f5bc (patch)
treea64d46711e332b9828dd5c2926f68da9dbe9835d /openbsd
parentc1b32892190ee0b605cac5087fb000f6cefc4b1e (diff)
Use dynamically allocated memory for process names
Even when they're constant, as is the case for zombie processes.
Diffstat (limited to 'openbsd')
-rw-r--r--openbsd/OpenBSDProcessList.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/openbsd/OpenBSDProcessList.c b/openbsd/OpenBSDProcessList.c
index d6420853..cbb90c91 100644
--- a/openbsd/OpenBSDProcessList.c
+++ b/openbsd/OpenBSDProcessList.c
@@ -132,9 +132,12 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
arg = kvm_getargv(kd, kproc, 500);
if (arg == NULL) {
- return "[zombie]";
// the FreeBSD port uses ki_comm, but we don't have it
//return strndup(kproc->ki_comm);
+ if ((s = strdup("[zombie]")) == NULL) {
+ err(1, NULL);
+ }
+ return s;
}
for (i = 0; arg[i] != NULL; i++) {
len += strlen(arg[i]) + 1;

© 2014-2024 Faster IT GmbH | imprint | privacy policy