[vlc-devel] commit: Fix input item leaking ( Rafaël Carré )

git version control git at videolan.org
Thu Apr 24 15:28:27 CEST 2008


vlc | branch: master | Rafaël Carré <funman at videolan.org> | Thu Apr 24 15:28:59 2008 +0200| [25b8641d713521fd4e0114b31b93516273845034]

Fix input item leaking

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=25b8641d713521fd4e0114b31b93516273845034
---

 modules/control/rc.c                       |    6 ++++--
 modules/gui/wxwidgets/dialogs/playlist.cpp |    1 +
 modules/gui/wxwidgets/dialogs/wizard.cpp   |    1 +
 modules/services_discovery/upnp_cc.cpp     |    1 +
 modules/services_discovery/upnp_intel.cpp  |    1 +
 5 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/control/rc.c b/modules/control/rc.c
index 5b37562..ab990ba 100644
--- a/modules/control/rc.c
+++ b/modules/control/rc.c
@@ -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;
             }
diff --git a/modules/gui/wxwidgets/dialogs/playlist.cpp b/modules/gui/wxwidgets/dialogs/playlist.cpp
index e3349ee..17d0022 100644
--- a/modules/gui/wxwidgets/dialogs/playlist.cpp
+++ b/modules/gui/wxwidgets/dialogs/playlist.cpp
@@ -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;
diff --git a/modules/gui/wxwidgets/dialogs/wizard.cpp b/modules/gui/wxwidgets/dialogs/wizard.cpp
index c8235ec..792a24e 100644
--- a/modules/gui/wxwidgets/dialogs/wizard.cpp
+++ b/modules/gui/wxwidgets/dialogs/wizard.cpp
@@ -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
diff --git a/modules/services_discovery/upnp_cc.cpp b/modules/services_discovery/upnp_cc.cpp
index ac9a77c..37dd4fa 100644
--- a/modules/services_discovery/upnp_cc.cpp
+++ b/modules/services_discovery/upnp_cc.cpp
@@ -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;
diff --git a/modules/services_discovery/upnp_intel.cpp b/modules/services_discovery/upnp_intel.cpp
index 63a4c97..c1d67a9 100644
--- a/modules/services_discovery/upnp_intel.cpp
+++ b/modules/services_discovery/upnp_intel.cpp
@@ -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 );




More information about the vlc-devel mailing list