From f1d867c0a1577e2c46d5dd4e262444e0cf6f8e25 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Sat, 23 Apr 2011 23:22:27 -0700 Subject: [PATCH] XQuartz: Silence clang static analyzer Call to 'malloc' has an allocation size of 0 bytes. Signed-off-by: Jeremy Huddleston --- hw/xquartz/mach-startup/stub.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/xquartz/mach-startup/stub.c b/hw/xquartz/mach-startup/stub.c index ccf5ab426..180456015 100644 --- a/hw/xquartz/mach-startup/stub.c +++ b/hw/xquartz/mach-startup/stub.c @@ -300,8 +300,8 @@ int main(int argc, char **argv, char **envp) { /* We have fixed-size string lengths due to limitations in IPC, * so we need to copy our argv and envp. */ - newargv = (string_array_t)malloc(argc * sizeof(string_t)); - newenvp = (string_array_t)malloc(envpc * sizeof(string_t)); + newargv = (string_array_t)calloc((1 + argc), sizeof(string_t)); + newenvp = (string_array_t)calloc((1 + envpc), sizeof(string_t)); if(!newargv || !newenvp) { fprintf(stderr, "Xquartz: Memory allocation failure\n");