Fix input item leaking
authorRafaël Carré <funman@videolan.org>
Thu, 24 Apr 2008 13:28:59 +0000 (15:28 +0200)
committerRafaël Carré <funman@videolan.org>
Thu, 24 Apr 2008 13:28:59 +0000 (15:28 +0200)
modules/control/rc.c
modules/gui/wxwidgets/dialogs/playlist.cpp
modules/gui/wxwidgets/dialogs/wizard.cpp
modules/services_discovery/upnp_cc.cpp
modules/services_discovery/upnp_intel.cpp

index 5b37562..ab990ba 100644 (file)
@@ -1431,9 +1431,11 @@ static int Playlist( vlc_object_t *p_this, char const *psz_cmd,
         if( p_item )
         {
             msg_rc( "Trying to add %s to playlist.", newval.psz_string );
-            if( playlist_AddInput( p_playlist, p_item,
+            int i_ret =playlist_AddInput( p_playlist, p_item,
                      PLAYLIST_GO|PLAYLIST_APPEND, PLAYLIST_END, true,
-                     false ) != VLC_SUCCESS )
+                     false );
+            vlc_gc_decref( p_item );
+            if( i_ret != VLC_SUCCESS )
             {
                 return VLC_EGENERIC;
             }
index e3349ee..17d0022 100644 (file)
@@ -1290,6 +1290,7 @@ bool PlaylistFileDropTarget::OnDropFiles( wxCoord x, wxCoord y,
                                               psz_utf8, psz_utf8 );
         int i_ret = ( playlist_NodeAddInput( p->p_playlist, p_input, p_dest,
                 PLAYLIST_PREPARSE, i_pos, false ) != VLC_SUCCESS );
+        vlc_gc_decref( p_input );
         wxDnDLocaleFree( psz_utf8 );
         if( i_ret != VLC_SUCCESS )
             return FALSE;
index c8235ec..792a24e 100644 (file)
@@ -1635,6 +1635,7 @@ void WizardDialog::Run()
             /* FIXME: playlist_AddInput() can fail */
             playlist_AddInput( p_playlist, p_input,
                                PLAYLIST_GO, PLAYLIST_END, true, false );
+            vlc_gc_decref( p_input );
             vlc_object_release(p_playlist);
         }
         else
index ac9a77c..37dd4fa 100644 (file)
@@ -221,6 +221,7 @@ void UPnPHandler::AddContent( playlist_item_t *p_parent, ContentNode *node )
         playlist_BothAddInput( p_playlist, p_input, p_parent,
                                PLAYLIST_APPEND, PLAYLIST_END, NULL, NULL,
                                false );
+        vlc_gc_decref( p_input );
     } else if ( node->isContainerNode() )
     {
         ContainerNode *conNode = (ContainerNode *)node;
index 63a4c97..c1d67a9 100644 (file)
@@ -875,6 +875,7 @@ void MediaServer::_buildPlaylist( Container* parent )
         playlist_BothAddInput( p_playlist, p_input, parentNode,
                                PLAYLIST_APPEND, PLAYLIST_END, &i_cat, NULL,
                                false );
+        vlc_gc_decref( p_input );
         /* TODO: do this better by storing ids */
         playlist_item_t *p_node = playlist_ItemGetById( p_playlist, i_cat, false );
         assert( p_node );