diff options
Diffstat (limited to 'xorg-server/hw/xquartz/mach-startup')
-rw-r--r-- | xorg-server/hw/xquartz/mach-startup/stub.c | 12 |
1 files changed, 8 insertions, 4 deletions
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; |