[vlc-commits] libvlc_media_list_player: fix invalid use of path

Thomas Guillem git at videolan.org
Mon Aug 22 17:23:48 CEST 2016


vlc | branch: master | Thomas Guillem <thomas at gllm.fr> | Mon Aug 22 17:03:21 2016 +0200| [a19fe33c97b6c57d1e2413bd4efe8ec69475d2a1] | committer: Thomas Guillem

libvlc_media_list_player: fix invalid use of path

The path variable (or current_playing_item_path) can be modified or freed from
an other thread.

Fixes #17312

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=a19fe33c97b6c57d1e2413bd4efe8ec69475d2a1
---

 lib/media_list_player.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/media_list_player.c b/lib/media_list_player.c
index 6f4ecb0..c6f80f2 100644
--- a/lib/media_list_player.c
+++ b/lib/media_list_player.c
@@ -686,13 +686,16 @@ int libvlc_media_list_player_play_item_at_index(libvlc_media_list_player_t * p_m
     lock(p_mlp);
     libvlc_media_list_path_t path = libvlc_media_list_path_with_root_index(i_index);
     set_current_playing_item(p_mlp, path);
+    libvlc_media_t *p_md = libvlc_media_player_get_media(p_mlp->p_mi);
     libvlc_media_player_play(p_mlp->p_mi);
     unlock(p_mlp);
 
+    if (!p_md)
+        return -1;
+
     /* Send the next item event */
     libvlc_event_t event;
     event.type = libvlc_MediaListPlayerNextItemSet;
-    libvlc_media_t * p_md = libvlc_media_list_item_at_path(p_mlp->p_mlist, path);
     event.u.media_list_player_next_item_set.item = p_md;
     libvlc_event_send(p_mlp->p_event_manager, &event);
     libvlc_media_release(p_md);



More information about the vlc-commits mailing list