]> git.sesse.net Git - vlc/commitdiff
Memory leaks
authorClément Stenac <zorglub@videolan.org>
Fri, 10 Dec 2004 20:24:19 +0000 (20:24 +0000)
committerClément Stenac <zorglub@videolan.org>
Fri, 10 Dec 2004 20:24:19 +0000 (20:24 +0000)
src/playlist/item-ext.c
src/playlist/item.c
src/playlist/view.c

index aebba71cd011084cd533cb4daaa0e37d45374e96..5671a7246aa44dc2e3734e56075c1d4f31175a82 100644 (file)
@@ -269,6 +269,8 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
         var_Set( p_playlist, "intf-change", val );
     }
 
+    free( p_add );
+
     return p_item->input.i_id;
 }
 
@@ -320,6 +322,7 @@ int playlist_NodeAddItem( playlist_t *p_playlist, playlist_item_t *p_item,
                 {
                     playlist_ItemDelete( p_item );
                     vlc_mutex_unlock( &p_playlist->object_lock );
+                    free( p_add );
                     return -1;
                 }
             }
@@ -377,6 +380,8 @@ int playlist_NodeAddItem( playlist_t *p_playlist, playlist_item_t *p_item,
 
     val.b_bool = VLC_TRUE;
 //    var_Set( p_playlist, "intf-change", val );
+//
+    free( p_add );
 
     return p_item->input.i_id;
 }
@@ -638,10 +643,15 @@ int playlist_Delete( playlist_t * p_playlist, int i_id )
 int playlist_Clear( playlist_t * p_playlist )
 {
     int i;
+    playlist_view_t *p_view;
     for( i = p_playlist->i_size; i > 0 ; i-- )
     {
         playlist_Delete( p_playlist, p_playlist->pp_items[0]->input.i_id );
     }
+    for( i = 0 ; i< p_playlist->i_views; i++ )
+    {
+        playlist_ViewEmpty( p_playlist, i, VLC_TRUE );
+    }
     return VLC_SUCCESS;
 }
 
index 38dc1efa3ced6ca9dc194278888b8e6c387893a3..9e5a5cd522590e9c446d00974c8c04fef55508a3 100644 (file)
@@ -128,6 +128,13 @@ int playlist_ItemDelete( playlist_item_t *p_item )
         if( p_item->input.i_options == 1 ) free( p_item->input.ppsz_options );
     }
 
+    for( ; p_item->i_parents > 0 ; )
+    {
+        struct item_parent_t *p_parent =  p_item->pp_parents[0];
+        REMOVE_ELEM( p_item->pp_parents, p_item->i_parents, 0 );
+        free( p_parent );
+    }
+
     vlc_mutex_unlock( &p_item->input.lock );
     vlc_mutex_destroy( &p_item->input.lock );
 
index b1193f1009e91fbcd66d58b58ee55589454cb6a1..d6be4402a17f3774aa9f27358082f74e2f272f8f 100644 (file)
@@ -183,6 +183,7 @@ int playlist_ViewUpdate( playlist_t *p_playlist, int i_view)
                             SORT_AUTHOR, ORDER_NORMAL );
     }
 
+
     return VLC_SUCCESS;
 }
 
@@ -294,6 +295,8 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist, int i_view,
     val.p_address = p_add;
     var_Set( p_playlist, "item-append", val);
 
+    free( p_add );
+
     return p_item;
 }
 
@@ -359,6 +362,7 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
         else if( b_delete_items )
         {
             /* Delete the item here */
+            playlist_Delete( p_playlist, p_root->pp_children[i]->input.i_id );
         }
     }
     /* Delete the node */
@@ -423,7 +427,7 @@ int playlist_NodeInsert( playlist_t *p_playlist,
    if( b_found == VLC_FALSE )
    {
         struct item_parent_t *p_ip = (struct item_parent_t *)
-                                malloc(sizeof(struct item_parent_t) );
+                                     malloc(sizeof(struct item_parent_t) );
         p_ip->i_view = i_view;
         p_ip->p_parent = p_parent;