FreeBSD: fix crash on empty environment

e.g. on kernel threads
This commit is contained in:
Christian Goettsche 2020-12-05 20:34:23 +01:00
parent 876194492f
commit 8d1595a20e

View File

@ -248,7 +248,7 @@ char* Platform_getProcessEnv(pid_t pid) {
char* env = xMalloc(capacity);
int err = sysctl(mib, 4, env, &capacity, NULL, 0);
if (err) {
if (err || capacity == 0) {
free(env);
return NULL;
}