From 75d2bbcf0f39b9c85bc270728343f61dabebce2d Mon Sep 17 00:00:00 2001 From: marha Date: Tue, 8 Dec 2009 11:23:34 +0000 Subject: Git update 8/12/2009 --- xorg-server/hw/xquartz/mach-startup/stub.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'xorg-server/hw/xquartz/mach-startup/stub.c') diff --git a/xorg-server/hw/xquartz/mach-startup/stub.c b/xorg-server/hw/xquartz/mach-startup/stub.c index af1c59efb..c8686e78f 100644 --- a/xorg-server/hw/xquartz/mach-startup/stub.c +++ b/xorg-server/hw/xquartz/mach-startup/stub.c @@ -306,12 +306,12 @@ 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)alloca(argc * sizeof(string_t)); - newenvp = (string_array_t)alloca(envpc * sizeof(string_t)); - + newargv = (string_array_t)malloc(argc * sizeof(string_t)); + newenvp = (string_array_t)malloc(envpc * sizeof(string_t)); + if(!newargv || !newenvp) { fprintf(stderr, "Xquartz: Memory allocation failure\n"); - exit(EXIT_FAILURE); + return EXIT_FAILURE; } for(i=0; i < argc; i++) { @@ -322,6 +322,10 @@ int main(int argc, char **argv, char **envp) { } kr = start_x11_server(mp, newargv, argc, newenvp, envpc); + + free(newargv); + free(newenvp); + if (kr != KERN_SUCCESS) { fprintf(stderr, "Xquartz: start_x11_server: %s\n", mach_error_string(kr)); return EXIT_FAILURE; -- cgit v1.2.3