mirror of https://github.com/xzeldon/htop.git
Use dynamically allocated memory for process names
Even when they're constant, as is the case for zombie processes.
This commit is contained in:
parent
c1b3289219
commit
3da36bbc61
|
@ -132,9 +132,12 @@ char *OpenBSDProcessList_readProcessName(kvm_t* kd, struct kinfo_proc* kproc, in
|
||||||
|
|
||||||
arg = kvm_getargv(kd, kproc, 500);
|
arg = kvm_getargv(kd, kproc, 500);
|
||||||
if (arg == NULL) {
|
if (arg == NULL) {
|
||||||
return "[zombie]";
|
|
||||||
// the FreeBSD port uses ki_comm, but we don't have it
|
// the FreeBSD port uses ki_comm, but we don't have it
|
||||||
//return strndup(kproc->ki_comm);
|
//return strndup(kproc->ki_comm);
|
||||||
|
if ((s = strdup("[zombie]")) == NULL) {
|
||||||
|
err(1, NULL);
|
||||||
|
}
|
||||||
|
return s;
|
||||||
}
|
}
|
||||||
for (i = 0; arg[i] != NULL; i++) {
|
for (i = 0; arg[i] != NULL; i++) {
|
||||||
len += strlen(arg[i]) + 1;
|
len += strlen(arg[i]) + 1;
|
||||||
|
|
Loading…
Reference in New Issue