mirror of https://github.com/xzeldon/htop.git
FreeBSD: fix crash on empty environment
e.g. on kernel threads
This commit is contained in:
parent
876194492f
commit
8d1595a20e
|
@ -248,7 +248,7 @@ char* Platform_getProcessEnv(pid_t pid) {
|
||||||
char* env = xMalloc(capacity);
|
char* env = xMalloc(capacity);
|
||||||
|
|
||||||
int err = sysctl(mib, 4, env, &capacity, NULL, 0);
|
int err = sysctl(mib, 4, env, &capacity, NULL, 0);
|
||||||
if (err) {
|
if (err || capacity == 0) {
|
||||||
free(env);
|
free(env);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue