The arguments to main() should be NULL terminated (SuS v3 compliant)
authorSam Lantinga <slouken@libsdl.org>
Tue, 06 Jul 2010 22:26:03 -0700
changeset 4489 2bb1bfeee9e2
parent 4488 6dc6a2bdd55e
child 4490 06c7423f8c60
The arguments to main() should be NULL terminated (SuS v3 compliant)
src/video/uikit/SDL_uikitappdelegate.m
--- a/src/video/uikit/SDL_uikitappdelegate.m	Tue Jul 06 22:08:19 2010 -0700
+++ b/src/video/uikit/SDL_uikitappdelegate.m	Tue Jul 06 22:26:03 2010 -0700
@@ -42,11 +42,12 @@
 	
 	/* store arguments */
 	forward_argc = argc;
-	forward_argv = (char **)malloc(argc * sizeof(char *));
+	forward_argv = (char **)malloc((argc+1) * sizeof(char *));
 	for (i=0; i<argc; i++) {
 		forward_argv[i] = malloc( (strlen(argv[i])+1) * sizeof(char));
 		strcpy(forward_argv[i], argv[i]);
 	}
+	forward_argv[i] = NULL;
 
 	/* Give over control to run loop, SDLUIKitDelegate will handle most things from here */
 	UIApplicationMain(argc, argv, NULL, @"SDLUIKitDelegate");