mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
(XMB) Fix xmb_list_insert() leak
This commit is contained in:
parent
b96ce78b3e
commit
936ab27541
@ -1921,7 +1921,10 @@ static void xmb_list_insert(file_list_t *list,
|
||||
if (!list || !xmb)
|
||||
return;
|
||||
|
||||
node = (xmb_node_t*)calloc(1, sizeof(xmb_node_t));
|
||||
node = (xmb_node_t*)file_list_get_userdata_at_offset(list, i);
|
||||
|
||||
if (!node)
|
||||
node = (xmb_node_t*)calloc(1, sizeof(xmb_node_t));
|
||||
|
||||
if (!node)
|
||||
{
|
||||
@ -1952,6 +1955,33 @@ static void xmb_list_free(file_list_t *list,
|
||||
{
|
||||
}
|
||||
|
||||
static void xmb_list_clear(file_list_t *list)
|
||||
{
|
||||
menu_handle_t *menu = menu_driver_get_ptr();
|
||||
size_t size, i;
|
||||
|
||||
|
||||
size = list->size;
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
float *subjects[5];
|
||||
xmb_node_t *node = (xmb_node_t*)file_list_get_userdata_at_offset(list, i);
|
||||
|
||||
if (!node)
|
||||
return;
|
||||
|
||||
subjects[0] = &node->alpha;
|
||||
subjects[1] = &node->label_alpha;
|
||||
subjects[2] = &node->zoom;
|
||||
subjects[3] = &node->x;
|
||||
subjects[4] = &node->y;
|
||||
|
||||
menu_animation_kill_by_subject(menu->display.animation, 5, subjects);
|
||||
|
||||
file_list_free_userdata(list, i);
|
||||
}
|
||||
}
|
||||
|
||||
static void xmb_list_deep_copy(menu_handle_t *menu, const file_list_t *src, file_list_t *dst)
|
||||
{
|
||||
size_t size, i;
|
||||
@ -1960,7 +1990,7 @@ static void xmb_list_deep_copy(menu_handle_t *menu, const file_list_t *src, file
|
||||
for (i = 0; i < size; ++i)
|
||||
{
|
||||
file_list_free_userdata(dst, i);
|
||||
file_list_free_actiondata(dst, i);
|
||||
file_list_free_actiondata(dst, i); /* this one was allocated by us */
|
||||
}
|
||||
|
||||
file_list_copy(src, dst);
|
||||
@ -2204,7 +2234,7 @@ menu_ctx_driver_t menu_ctx_xmb = {
|
||||
xmb_navigation_alphabet,
|
||||
xmb_list_insert,
|
||||
xmb_list_free,
|
||||
NULL,
|
||||
xmb_list_clear,
|
||||
xmb_list_cache,
|
||||
xmb_list_get_selection,
|
||||
xmb_list_get_size,
|
||||
|
Loading…
x
Reference in New Issue
Block a user