[vlc-commits] playlist: forcefully delete children of writable parent

Filip Roséen git at videolan.org
Sun May 21 21:22:12 CEST 2017


vlc | branch: master | Filip Roséen <filip at atch.se> | Sun May 21 20:48:17 2017 +0200| [85bcdf75984d0a8b9100592c10f04300dc8fb583] | committer: Rémi Denis-Courmont

playlist: forcefully delete children of writable parent

If a parent is writable, but has read-only children, the previous
implementation would not delete the children, while deletion of the
parent would go through.

Which would, of course, result in a leak of the children in question.

Signed-off-by: Rémi Denis-Courmont <remi at remlab.net>

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

 src/playlist/tree.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/src/playlist/tree.c b/src/playlist/tree.c
index 8358932622..891be5456f 100644
--- a/src/playlist/tree.c
+++ b/src/playlist/tree.c
@@ -100,15 +100,16 @@ void playlist_NodeDeleteExplicit( playlist_t *p_playlist,
 {
     PL_ASSERT_LOCKED;
 
-    /* Delete the children */
-    for( int i = p_root->i_children - 1 ; i >= 0; i-- )
-        playlist_NodeDeleteExplicit( p_playlist, p_root->pp_children[i], flags );
-
     /* Delete the node */
     if( p_root->i_flags & PLAYLIST_RO_FLAG &&
         !( flags & PLAYLIST_DELETE_FORCE ) )
         return;
 
+    /* Delete the children */
+    for( int i = p_root->i_children - 1 ; i >= 0; i-- )
+        playlist_NodeDeleteExplicit( p_playlist,
+            p_root->pp_children[i], flags | PLAYLIST_DELETE_FORCE );
+
     pl_priv(p_playlist)->b_reset_currently_playing = true;
 
     int i;



More information about the vlc-commits mailing list