From f2e4625858c1da99dede5f4b3b8e7c959264fa82 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Fri, 13 Jun 2014 18:11:08 +0200 Subject: [PATCH] (GX/PS3/PSP/XDK) Don't use strdup anymore for setting wrap arguments --- frontend/platform/platform_gx.c | 5 +++-- frontend/platform/platform_ps3.c | 5 +++-- frontend/platform/platform_psp.c | 5 +++-- frontend/platform/platform_xdk.c | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/frontend/platform/platform_gx.c b/frontend/platform/platform_gx.c index 1985d5721b..aa2a5d6a17 100644 --- a/frontend/platform/platform_gx.c +++ b/frontend/platform/platform_gx.c @@ -200,7 +200,8 @@ static void frontend_gx_get_environment_settings(int *argc, char *argv[], // needed on Wii; loaders follow a dumb standard where the path and filename are separate in the argument list if (*argc > 2 && argv[1] != NULL && argv[2] != NULL) { - char path[PATH_MAX]; + static char path[PATH_MAX]; + *path = '\0'; struct rarch_main_wrap *args = (struct rarch_main_wrap*)params_data; if (args) @@ -213,7 +214,7 @@ static void frontend_gx_get_environment_settings(int *argc, char *argv[], args->config_path = NULL; args->sram_path = NULL; args->state_path = NULL; - args->rom_path = strdup(path); + args->rom_path = path; args->libretro_path = NULL; } } diff --git a/frontend/platform/platform_ps3.c b/frontend/platform/platform_ps3.c index 22dd446a1b..f45294b6ec 100644 --- a/frontend/platform/platform_ps3.c +++ b/frontend/platform/platform_ps3.c @@ -122,7 +122,8 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[], #ifndef IS_SALAMANDER if (*argc > 1 && argv[1] != NULL && argv[1][0] != '\0') { - char path[PATH_MAX]; + static char path[PATH_MAX]; + *path = '\0'; struct rarch_main_wrap *args = (struct rarch_main_wrap*)params_data; if (args) @@ -135,7 +136,7 @@ static void frontend_ps3_get_environment_settings(int *argc, char *argv[], args->config_path = NULL; args->sram_path = NULL; args->state_path = NULL; - args->rom_path = strdup(path); + args->rom_path = path; args->libretro_path = NULL; RARCH_LOG("argv[0]: %s\n", argv[0]); diff --git a/frontend/platform/platform_psp.c b/frontend/platform/platform_psp.c index 56be30ccc1..5864a67860 100644 --- a/frontend/platform/platform_psp.c +++ b/frontend/platform/platform_psp.c @@ -71,7 +71,8 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[], if (argv[1] && (argv[1][0] != '\0')) { - char path[PATH_MAX]; + static char path[PATH_MAX]; + *path = '\0'; struct rarch_main_wrap *args = (struct rarch_main_wrap*)params_data; if (args) @@ -84,7 +85,7 @@ static void frontend_psp_get_environment_settings(int *argc, char *argv[], args->config_path = NULL; args->sram_path = NULL; args->state_path = NULL; - args->rom_path = strdup(path); + args->rom_path = path; args->libretro_path = NULL; RARCH_LOG("argv[0]: %s\n", argv[0]); diff --git a/frontend/platform/platform_xdk.c b/frontend/platform/platform_xdk.c index 929c83621d..a6690927b2 100644 --- a/frontend/platform/platform_xdk.c +++ b/frontend/platform/platform_xdk.c @@ -156,7 +156,8 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[], #endif #ifndef IS_SALAMANDER - char path[PATH_MAX]; + static char path[PATH_MAX]; + *path = '\0'; #if defined(_XBOX1) RARCH_LOG("Gets here top.\n"); LAUNCH_DATA ptr; @@ -212,7 +213,7 @@ static void frontend_xdk_get_environment_settings(int *argc, char *argv[], args->config_path = NULL; args->sram_path = NULL; args->state_path = NULL; - args->rom_path = strdup(path); + args->rom_path = path; args->libretro_path = NULL; RARCH_LOG("Auto-start game %s.\n", path);