diff src/main/macosx/SDLMain.m @ 1572:3a8920cc822b

*** empty log message ***
author Sam Lantinga <slouken@libsdl.org>
date Tue, 21 Mar 2006 16:04:44 +0000
parents 304d8dd6a989
children 24247fe40188
line wrap: on
line diff
--- a/src/main/macosx/SDLMain.m	Tue Mar 21 10:38:41 2006 +0000
+++ b/src/main/macosx/SDLMain.m	Tue Mar 21 16:04:44 2006 +0000
@@ -252,19 +252,20 @@
         return FALSE;
 
     const char *temparg = [filename UTF8String];
-    char *arg = (char *) malloc(strlen(temparg) + 1);
+    size_t arglen = SDL_strlen(temparg) + 1;
+    char *arg = (char *) SDL_malloc(arglen);
     if (arg == NULL)
         return FALSE;
 
     char **newargv = (char **) realloc(gArgv, sizeof (char *) * (gArgc + 2));
     if (newargv == NULL)
     {
-        free(arg);
+        SDL_free(arg);
         return FALSE;
     }
     gArgv = newargv;
 
-    strcpy(arg, temparg);
+    SDL_strlcpy(arg, temparg, arglen);
     gArgv[gArgc++] = arg;
     gArgv[gArgc] = NULL;
     return TRUE;
@@ -346,7 +347,7 @@
     /* Copy the arguments into a global variable */
     /* This is passed if we are launched by double-clicking */
     if ( argc >= 2 && strncmp (argv[1], "-psn", 4) == 0 ) {
-        gArgv = (char **) malloc(sizeof (char *) * 2);
+        gArgv = (char **) SDL_malloc(sizeof (char *) * 2);
         gArgv[0] = argv[0];
         gArgv[1] = NULL;
         gArgc = 1;
@@ -354,7 +355,7 @@
     } else {
         int i;
         gArgc = argc;
-        gArgv = (char **) malloc(sizeof (char *) * (argc+1));
+        gArgv = (char **) SDL_malloc(sizeof (char *) * (argc+1));
         for (i = 0; i <= argc; i++)
             gArgv[i] = argv[i];
         gFinderLaunch = NO;