mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
have http tasks clean up after themselves
This commit is contained in:
parent
b59c5f6ff9
commit
501fe45a9f
@ -4123,13 +4123,6 @@ finish:
|
|||||||
subdir_path, 0, 0, 0, ACTION_OK_DL_CORE_CONTENT_DIRS_SUBDIR_LIST);*/
|
subdir_path, 0, 0, 0, ACTION_OK_DL_CORE_CONTENT_DIRS_SUBDIR_LIST);*/
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user_data)
|
if (user_data)
|
||||||
free(user_data);
|
free(user_data);
|
||||||
}
|
}
|
||||||
@ -4168,13 +4161,6 @@ finish:
|
|||||||
refresh = true;
|
refresh = true;
|
||||||
menu_entries_ctl(MENU_ENTRIES_CTL_UNSET_REFRESH, &refresh);
|
menu_entries_ctl(MENU_ENTRIES_CTL_UNSET_REFRESH, &refresh);
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!err &&
|
if (!err &&
|
||||||
!string_ends_with_size(state->path,
|
!string_ends_with_size(state->path,
|
||||||
FILE_PATH_INDEX_DIRS_URL,
|
FILE_PATH_INDEX_DIRS_URL,
|
||||||
@ -4485,13 +4471,6 @@ finish:
|
|||||||
discord_avatar_set_ready(true);
|
discord_avatar_set_ready(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transf)
|
if (transf)
|
||||||
free(transf);
|
free(transf);
|
||||||
}
|
}
|
||||||
@ -5548,16 +5527,8 @@ finish:
|
|||||||
if (err)
|
if (err)
|
||||||
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err);
|
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err);
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user_data)
|
if (user_data)
|
||||||
free(user_data);
|
free(user_data);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef RARCH_CONSOLE
|
#ifndef RARCH_CONSOLE
|
||||||
|
19
retroarch.c
19
retroarch.c
@ -8867,13 +8867,6 @@ finish:
|
|||||||
if (err)
|
if (err)
|
||||||
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err);
|
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), err);
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (user_data)
|
if (user_data)
|
||||||
free(user_data);
|
free(user_data);
|
||||||
}
|
}
|
||||||
@ -9763,10 +9756,7 @@ static void netplay_announce_cb(retro_task_t *task,
|
|||||||
char *host_string = NULL;
|
char *host_string = NULL;
|
||||||
|
|
||||||
if (data->len == 0)
|
if (data->len == 0)
|
||||||
{
|
|
||||||
free(task_data);
|
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
buf = (char*)calloc(1, data->len + 1);
|
buf = (char*)calloc(1, data->len + 1);
|
||||||
|
|
||||||
@ -9778,7 +9768,6 @@ static void netplay_announce_cb(retro_task_t *task,
|
|||||||
{
|
{
|
||||||
string_list_free(lines);
|
string_list_free(lines);
|
||||||
free(buf);
|
free(buf);
|
||||||
free(task_data);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -9905,7 +9894,7 @@ static void netplay_announce_cb(retro_task_t *task,
|
|||||||
|
|
||||||
string_list_free(lines);
|
string_list_free(lines);
|
||||||
free(buf);
|
free(buf);
|
||||||
free(task_data);
|
|
||||||
if (mitm_ip)
|
if (mitm_ip)
|
||||||
free(mitm_ip);
|
free(mitm_ip);
|
||||||
if (mitm_port)
|
if (mitm_port)
|
||||||
@ -14042,12 +14031,6 @@ finish:
|
|||||||
if (error)
|
if (error)
|
||||||
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), error);
|
RARCH_ERR("%s: %s\n", msg_hash_to_str(MSG_DOWNLOAD_FAILED), error);
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
if (user_data)
|
if (user_data)
|
||||||
free(user_data);
|
free(user_data);
|
||||||
|
|
||||||
|
@ -234,10 +234,13 @@ static void cb_http_task_core_updater_get_list(
|
|||||||
if (!list_handle)
|
if (!list_handle)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
|
task_set_data(task, NULL); /* going to pass ownership to list_handle */
|
||||||
|
|
||||||
list_handle->http_data = data;
|
list_handle->http_data = data;
|
||||||
list_handle->http_task_complete = true;
|
list_handle->http_task_complete = true;
|
||||||
list_handle->http_task_success = success;
|
list_handle->http_task_success = success;
|
||||||
|
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
|
|
||||||
/* Log any error messages */
|
/* Log any error messages */
|
||||||
@ -258,6 +261,7 @@ static void free_core_updater_list_handle(
|
|||||||
|
|
||||||
if (list_handle->http_data)
|
if (list_handle->http_data)
|
||||||
{
|
{
|
||||||
|
/* since we took onwership, we have to destroy it ourself */
|
||||||
if (list_handle->http_data->data)
|
if (list_handle->http_data->data)
|
||||||
free(list_handle->http_data->data);
|
free(list_handle->http_data->data);
|
||||||
|
|
||||||
@ -644,13 +648,6 @@ finish:
|
|||||||
RARCH_ERR("[core updater] Download of '%s' failed: %s\n",
|
RARCH_ERR("[core updater] Download of '%s' failed: %s\n",
|
||||||
(transf ? transf->path: "unknown"), err);
|
(transf ? transf->path: "unknown"), err);
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transf)
|
if (transf)
|
||||||
free(transf);
|
free(transf);
|
||||||
}
|
}
|
||||||
|
@ -211,6 +211,17 @@ task_finished:
|
|||||||
free(http);
|
free(http);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void task_http_transfer_cleanup(retro_task_t *task)
|
||||||
|
{
|
||||||
|
http_transfer_data_t* data = task_get_data(task);
|
||||||
|
if (data)
|
||||||
|
{
|
||||||
|
if (data->data)
|
||||||
|
free(data->data);
|
||||||
|
free(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static bool task_http_finder(retro_task_t *task, void *user_data)
|
static bool task_http_finder(retro_task_t *task, void *user_data)
|
||||||
{
|
{
|
||||||
http_handle_t *http = NULL;
|
http_handle_t *http = NULL;
|
||||||
@ -305,6 +316,7 @@ static void* task_push_http_transfer_generic(
|
|||||||
t->mute = mute;
|
t->mute = mute;
|
||||||
t->callback = cb;
|
t->callback = cb;
|
||||||
t->progress_cb = http_transfer_progress_cb;
|
t->progress_cb = http_transfer_progress_cb;
|
||||||
|
t->cleanup = task_http_transfer_cleanup;
|
||||||
t->user_data = user_data;
|
t->user_data = user_data;
|
||||||
t->progress = -1;
|
t->progress = -1;
|
||||||
|
|
||||||
|
@ -227,13 +227,6 @@ finish:
|
|||||||
(transf ? transf->path: "unknown"), err);
|
(transf ? transf->path: "unknown"), err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data)
|
|
||||||
{
|
|
||||||
if (data->data)
|
|
||||||
free(data->data);
|
|
||||||
free(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (transf)
|
if (transf)
|
||||||
free(transf);
|
free(transf);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user