media_track: fix tracklist leak when no track found

When count is 0 the list is still allocated. Either we should not allocate
one, we free it locally, or we pass it on as it.
The latter is similar to the code from 40c14fbee4
in libvlc_media_tracklist_from_es_array().

Introduced in 057f3ef9e8.
This commit is contained in:
Steve Lhomme 2023-03-10 13:03:28 +01:00 committed by Jean-Baptiste Kempf
parent 4bc4577b99
commit 656e5eb27a
1 changed files with 1 additions and 1 deletions

View File

@ -270,7 +270,7 @@ libvlc_media_tracklist_from_player( vlc_player_t *player,
libvlc_media_tracklist_t *list = libvlc_media_tracklist_alloc( count );
if( count == 0 || list == NULL )
return NULL;
return list;
for( size_t i = 0; i < count; ++i )
{