mirror of
https://github.com/libretro/RetroArch
synced 2025-04-01 04:20:27 +00:00
Try to be more safe here
This commit is contained in:
parent
3d098839ca
commit
ac416b4494
19
playlist.c
19
playlist.c
@ -302,7 +302,10 @@ bool playlist_push(playlist_t *playlist,
|
|||||||
|
|
||||||
if (playlist->size == playlist->cap)
|
if (playlist->size == playlist->cap)
|
||||||
{
|
{
|
||||||
playlist_free_entry(&playlist->entries[playlist->cap - 1]);
|
struct playlist_entry *entry = &playlist->entries[playlist->cap - 1];
|
||||||
|
|
||||||
|
if (entry)
|
||||||
|
playlist_free_entry(entry);
|
||||||
playlist->size--;
|
playlist->size--;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -383,7 +386,12 @@ void playlist_free(playlist_t *playlist)
|
|||||||
playlist->conf_path = NULL;
|
playlist->conf_path = NULL;
|
||||||
|
|
||||||
for (i = 0; i < playlist->cap; i++)
|
for (i = 0; i < playlist->cap; i++)
|
||||||
playlist_free_entry(&playlist->entries[i]);
|
{
|
||||||
|
struct playlist_entry *entry = &playlist->entries[i];
|
||||||
|
|
||||||
|
if (entry)
|
||||||
|
playlist_free_entry(entry);
|
||||||
|
}
|
||||||
|
|
||||||
free(playlist->entries);
|
free(playlist->entries);
|
||||||
playlist->entries = NULL;
|
playlist->entries = NULL;
|
||||||
@ -404,7 +412,12 @@ void playlist_clear(playlist_t *playlist)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0; i < playlist->cap; i++)
|
for (i = 0; i < playlist->cap; i++)
|
||||||
playlist_free_entry(&playlist->entries[i]);
|
{
|
||||||
|
struct playlist_entry *entry = &playlist->entries[i];
|
||||||
|
|
||||||
|
if (entry)
|
||||||
|
playlist_free_entry(entry);
|
||||||
|
}
|
||||||
playlist->size = 0;
|
playlist->size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user