]> git.sesse.net Git - vlc/blobdiff - src/playlist/loadsave.c
Avoid a segfault when services_discovery_GetServicesNames fail.
[vlc] / src / playlist / loadsave.c
index 97dccca3e11f21c0812244959f49c1f20e7d403a..4f6c0ccfd0951b5f25a410ff31037fc2e306b8ad 100644 (file)
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
 #include <vlc/vlc.h>
 #include <vlc_playlist.h>
 #include <vlc_events.h>
 #include "playlist_internal.h"
-#include "config/config.h"
+#include "config/configuration.h"
 #include <vlc_charset.h>
 
 #include <sys/types.h>
@@ -97,14 +101,6 @@ static void input_item_subitem_added( const vlc_event_t * p_event,
     playlist_t *p_playlist = user_data;
     input_item_t *p_item = p_event->u.input_item_subitem_added.p_new_child;
 
-    /* The media library input has one and only one option: "meta-file"
-     * So we remove that unneeded option. */
-    if( p_item->i_options == 1 )
-    {
-        free( p_item->ppsz_options[0] );
-        p_item->i_options = 0;
-    }
-
     playlist_AddInput( p_playlist, p_item, PLAYLIST_APPEND, PLAYLIST_END,
             VLC_FALSE, VLC_FALSE );
 }
@@ -151,7 +147,7 @@ int playlist_MLLoad( playlist_t *p_playlist )
         goto error;
 
     p_playlist->p_ml_onelevel->p_input =
-    p_playlist->p_ml_category->p_input = p_input; /* We leak that apparently */
+    p_playlist->p_ml_category->p_input = p_input;
 
     vlc_event_attach( &p_input->event_manager, vlc_InputItemSubItemAdded,
                         input_item_subitem_added, p_playlist );
@@ -196,6 +192,7 @@ 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;