lib: media_list_player: fix leaks

Signed-off-by: Felix Paul Kühne <felix@feepk.net>
This commit is contained in:
Thomas Guillem 2023-05-17 08:40:22 +02:00 committed by Steve Lhomme
parent 4e4e389c01
commit 56529098b0
1 changed files with 5 additions and 0 deletions

View File

@ -171,7 +171,11 @@ get_next_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
int depth = libvlc_media_list_path_depth(p_mlp->current_playing_item_path);
if (depth < 1 || !p_parent_of_playing_item)
{
if (p_parent_of_playing_item)
libvlc_media_list_release(p_parent_of_playing_item);
return NULL;
}
ret = libvlc_media_list_path_copy(p_mlp->current_playing_item_path);
ret[depth - 1]++; /* set to next element */
@ -197,6 +201,7 @@ get_next_path(libvlc_media_list_player_t * p_mlp, bool b_loop)
}
ret[depth] = -1;
ret[depth-1]++;
libvlc_media_list_release(p_parent_of_playing_item);
p_parent_of_playing_item = libvlc_media_list_parentlist_at_path(
p_mlp->p_mlist,
ret);