[vlc-devel] [PATCH 7/8] playlist: forcefully delete children of writable parent

Filip Roséen filip at atch.se
Sun May 21 20:48:17 CEST 2017


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.
---
 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;
-- 
2.13.0


More information about the vlc-devel mailing list