From 1bf0175da4b83a6548b6719d6982a8f99129bf83 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 16 May 2017 04:50:20 +0200 Subject: [PATCH] Try to prevent string message leaking in tasks --- tasks/task_autodetect.c | 7 +++++++ tasks/task_netplay_find_content.c | 6 ++++++ 2 files changed, 13 insertions(+) diff --git a/tasks/task_autodetect.c b/tasks/task_autodetect.c index cd55c50949..1c25aed910 100644 --- a/tasks/task_autodetect.c +++ b/tasks/task_autodetect.c @@ -168,7 +168,10 @@ static void input_autoconfigure_joypad_add(config_file_t *conf, string_is_empty(display_name) ? params->name : display_name); if(!remote_is_bound) + { + task_free_title(task); task_set_title(task, strdup(msg)); + } remote_is_bound = true; if (params->idx == 0) input_autoconfigure_swap_override = true; @@ -189,7 +192,10 @@ static void input_autoconfigure_joypad_add(config_file_t *conf, } if (!block_osd_spam) + { + task_free_title(task); task_set_title(task, strdup(msg)); + } } @@ -335,6 +341,7 @@ static void input_autoconfigure_connect_handler(retro_task_t *task) params->name, (long)params->vid, (long)params->pid, msg_hash_to_str(MSG_DEVICE_NOT_CONFIGURED)); #endif + task_free_title(task); task_set_title(task, strdup(msg)); } diff --git a/tasks/task_netplay_find_content.c b/tasks/task_netplay_find_content.c index 7729767127..88a23ce516 100644 --- a/tasks/task_netplay_find_content.c +++ b/tasks/task_netplay_find_content.c @@ -102,12 +102,14 @@ static void task_netplay_crc_scan_handler(retro_task_t *task) netplay_crc_handle_t *state = (netplay_crc_handle_t*)task->state; task_set_progress(task, 0); + task_free_title(task); task_set_title(task, strdup("Looking for compatible content...")); task_set_finished(task, false); if (!state->lpl_list) { task_set_progress(task, 100); + task_free_title(task); task_set_title(task, strdup("Playlist directory not found")); task_set_finished(task, true); free(state); @@ -149,6 +151,7 @@ static void task_netplay_crc_scan_handler(retro_task_t *task) state->found = true; task_set_data(task, state); task_set_progress(task, 100); + task_free_title(task); task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND))); task_set_finished(task, true); string_list_free(state->lpl_list); @@ -209,6 +212,7 @@ filename_matching: state->found = true; task_set_data(task, state); task_set_progress(task, 100); + task_free_title(task); task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND))); task_set_finished(task, true); string_list_free(state->lpl_list); @@ -232,6 +236,7 @@ filename_matching: state->found = true; task_set_data(task, state); task_set_progress(task, 100); + task_free_title(task); task_set_title(task, strdup(msg_hash_to_str(MENU_ENUM_LABEL_VALUE_NETPLAY_COMPAT_CONTENT_FOUND))); task_set_finished(task, true); return; @@ -240,6 +245,7 @@ filename_matching: no_playlists: string_list_free(state->lpl_list); task_set_progress(task, 100); + task_free_title(task); task_set_title(task, strdup("Content not found, try manual load or disconnect from host")); task_set_finished(task, true); command_event(CMD_EVENT_NETPLAY_INIT_DIRECT_DEFERRED, state->hostname);