summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Huddleston <jeremyhu@apple.com>2011-04-23 23:22:27 -0700
committerJeremy Huddleston <jeremyhu@apple.com>2011-04-25 18:57:03 -0700
commitf1d867c0a1577e2c46d5dd4e262444e0cf6f8e25 (patch)
tree5223f8ad0f0c52349186c5fc734e93ec92857c59
parent913223e9ddf2cb927ecad99aeadfa730df8561ac (diff)
XQuartz: Silence clang static analyzer
Call to 'malloc' has an allocation size of 0 bytes. Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r--hw/xquartz/mach-startup/stub.c4
1 files 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");