Commit f7560a07 authored by Clément Stenac's avatar Clément Stenac

Memory leaks

parent 01aca2cc
...@@ -269,6 +269,8 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t *p_item, ...@@ -269,6 +269,8 @@ int playlist_AddItem( playlist_t *p_playlist, playlist_item_t *p_item,
var_Set( p_playlist, "intf-change", val ); var_Set( p_playlist, "intf-change", val );
} }
free( p_add );
return p_item->input.i_id; return p_item->input.i_id;
} }
...@@ -320,6 +322,7 @@ int playlist_NodeAddItem( playlist_t *p_playlist, playlist_item_t *p_item, ...@@ -320,6 +322,7 @@ int playlist_NodeAddItem( playlist_t *p_playlist, playlist_item_t *p_item,
{ {
playlist_ItemDelete( p_item ); playlist_ItemDelete( p_item );
vlc_mutex_unlock( &p_playlist->object_lock ); vlc_mutex_unlock( &p_playlist->object_lock );
free( p_add );
return -1; return -1;
} }
} }
...@@ -377,6 +380,8 @@ int playlist_NodeAddItem( playlist_t *p_playlist, playlist_item_t *p_item, ...@@ -377,6 +380,8 @@ int playlist_NodeAddItem( playlist_t *p_playlist, playlist_item_t *p_item,
val.b_bool = VLC_TRUE; val.b_bool = VLC_TRUE;
// var_Set( p_playlist, "intf-change", val ); // var_Set( p_playlist, "intf-change", val );
//
free( p_add );
return p_item->input.i_id; return p_item->input.i_id;
} }
...@@ -638,10 +643,15 @@ int playlist_Delete( playlist_t * p_playlist, int i_id ) ...@@ -638,10 +643,15 @@ int playlist_Delete( playlist_t * p_playlist, int i_id )
int playlist_Clear( playlist_t * p_playlist ) int playlist_Clear( playlist_t * p_playlist )
{ {
int i; int i;
playlist_view_t *p_view;
for( i = p_playlist->i_size; i > 0 ; i-- ) for( i = p_playlist->i_size; i > 0 ; i-- )
{ {
playlist_Delete( p_playlist, p_playlist->pp_items[0]->input.i_id ); 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; return VLC_SUCCESS;
} }
......
...@@ -128,6 +128,13 @@ int playlist_ItemDelete( playlist_item_t *p_item ) ...@@ -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 ); 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_unlock( &p_item->input.lock );
vlc_mutex_destroy( &p_item->input.lock ); vlc_mutex_destroy( &p_item->input.lock );
......
...@@ -183,6 +183,7 @@ int playlist_ViewUpdate( playlist_t *p_playlist, int i_view) ...@@ -183,6 +183,7 @@ int playlist_ViewUpdate( playlist_t *p_playlist, int i_view)
SORT_AUTHOR, ORDER_NORMAL ); SORT_AUTHOR, ORDER_NORMAL );
} }
return VLC_SUCCESS; return VLC_SUCCESS;
} }
...@@ -294,6 +295,8 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist, int i_view, ...@@ -294,6 +295,8 @@ playlist_item_t * playlist_NodeCreate( playlist_t *p_playlist, int i_view,
val.p_address = p_add; val.p_address = p_add;
var_Set( p_playlist, "item-append", val); var_Set( p_playlist, "item-append", val);
free( p_add );
return p_item; return p_item;
} }
...@@ -359,6 +362,7 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root, ...@@ -359,6 +362,7 @@ int playlist_NodeDelete( playlist_t *p_playlist, playlist_item_t *p_root,
else if( b_delete_items ) else if( b_delete_items )
{ {
/* Delete the item here */ /* Delete the item here */
playlist_Delete( p_playlist, p_root->pp_children[i]->input.i_id );
} }
} }
/* Delete the node */ /* Delete the node */
...@@ -423,7 +427,7 @@ int playlist_NodeInsert( playlist_t *p_playlist, ...@@ -423,7 +427,7 @@ int playlist_NodeInsert( playlist_t *p_playlist,
if( b_found == VLC_FALSE ) if( b_found == VLC_FALSE )
{ {
struct item_parent_t *p_ip = (struct item_parent_t *) 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->i_view = i_view;
p_ip->p_parent = p_parent; p_ip->p_parent = p_parent;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment