[vlc-devel] commit: Avoid leaking input items ( Rafaël Carré )
git version control
git at videolan.org
Mon Mar 31 22:42:55 CEST 2008
vlc | branch: master | Rafaël Carré <funman at videolan.org> | Mon Mar 31 22:43:21 2008 +0200| [cf5667bd8ce8bfd6c99c55a225361a2af1539b30]
Avoid leaking input items
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cf5667bd8ce8bfd6c99c55a225361a2af1539b30
---
src/playlist/engine.c | 4 +---
src/playlist/loadsave.c | 3 ++-
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/playlist/engine.c b/src/playlist/engine.c
index 444932d..5dc8257 100644
--- a/src/playlist/engine.c
+++ b/src/playlist/engine.c
@@ -478,11 +478,9 @@ void playlist_LastLoop( playlist_t *p_playlist )
playlist_MLDump( p_playlist );
PL_LOCK;
- /* Go through all items, and simply free everything without caring
- * about the tree structure. Do not decref, it will be done by doing
- * the same thing on the input items array */
FOREACH_ARRAY( playlist_item_t *p_del, p_playlist->all_items )
free( p_del->pp_children );
+ vlc_gc_decref( p_del->p_input );
free( p_del );
FOREACH_END();
ARRAY_RESET( p_playlist->all_items );
diff --git a/src/playlist/loadsave.c b/src/playlist/loadsave.c
index b50c76d..55b2a27 100644
--- a/src/playlist/loadsave.c
+++ b/src/playlist/loadsave.c
@@ -151,6 +151,8 @@ int playlist_MLLoad( playlist_t *p_playlist )
p_playlist->p_ml_onelevel->p_input =
p_playlist->p_ml_category->p_input = p_input;
+ vlc_gc_incref( p_input );
+
vlc_event_attach( &p_input->event_manager, vlc_InputItemSubItemAdded,
input_item_subitem_added, p_playlist );
@@ -194,7 +196,6 @@ int playlist_MLDump( playlist_t *p_playlist )
stats_TimerStart( p_playlist, "ML Dump", STATS_TIMER_ML_DUMP );
playlist_Export( p_playlist, psz_dirname, p_playlist->p_ml_category,
"export-xspf" );
- vlc_gc_decref( p_playlist->p_ml_category->p_input );
stats_TimerStop( p_playlist, STATS_TIMER_ML_DUMP );
return VLC_SUCCESS;
More information about the vlc-devel
mailing list