summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Goettsche <cgzones@googlemail.com>2020-12-05 20:34:23 +0100
committerChristian Goettsche <cgzones@googlemail.com>2020-12-05 20:34:23 +0100
commit8d1595a20e2a23fd1afc52c667bd7943eaa89b67 (patch)
tree03ea17535368a99387fe8ef7ee48b3e612d7be2d
parent876194492fc4ed2dfb16f7a3f7e46bb46e5303fc (diff)
FreeBSD: fix crash on empty environment
e.g. on kernel threads
-rw-r--r--freebsd/Platform.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/freebsd/Platform.c b/freebsd/Platform.c
index 506cafb4..bc77cf46 100644
--- a/freebsd/Platform.c
+++ b/freebsd/Platform.c
@@ -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;
}

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