From d5eb72e64d2fbacb2b7045a07468b6bb1b8435a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Sat, 12 Sep 2020 18:14:39 +0200 Subject: [PATCH] Drop always true condition `env` is allocated by checked allocation functions and can not be NULL. This checks confuses clang analyzer and causes a null-dereference warning on `env[size-1]`. --- linux/Platform.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/Platform.c b/linux/Platform.c index ffe5c5c2..e82d8f88 100644 --- a/linux/Platform.c +++ b/linux/Platform.c @@ -237,7 +237,7 @@ char* Platform_getProcessEnv(pid_t pid) { if (fd) { size_t capacity = 4096, size = 0, bytes; env = xMalloc(capacity); - while (env && (bytes = fread(env+size, 1, capacity-size, fd)) > 0) { + while ((bytes = fread(env+size, 1, capacity-size, fd)) > 0) { size += bytes; capacity *= 2; env = xRealloc(env, capacity);