]> git.sesse.net Git - vlc/blobdiff - src/playlist/services_discovery.c
Remove useless test before freeing something.
[vlc] / src / playlist / services_discovery.c
index e3e787f9aa8683f46bf20c4edb3aaca0ff0c49f4..c7bc7eb06e0a495d06753b7b79e3d4665358d256 100644 (file)
@@ -77,7 +77,7 @@ services_discovery_Create ( vlc_object_t * p_super, const char * psz_module_name
     if( p_sd->p_module == NULL )
     {
         msg_Err( p_super, "no suitable services discovery module" );
-        vlc_object_destroy( p_sd );
+        vlc_object_release( p_sd );
         return NULL;
     }
     p_sd->psz_module = strdup( psz_module_name );
@@ -98,7 +98,7 @@ void services_discovery_Destroy ( services_discovery_t * p_sd )
     free( p_sd->psz_localized_name );
 
     vlc_object_detach( p_sd );
-    vlc_object_destroy( p_sd );
+    vlc_object_release( p_sd );
 }
 
 /***********************************************************************
@@ -111,7 +111,7 @@ int services_discovery_Start ( services_discovery_t * p_sd )
                               VLC_THREAD_PRIORITY_LOW, VLC_FALSE))
     {
         msg_Err( p_sd, "cannot create services discovery thread" );
-        vlc_object_destroy( p_sd );
+        vlc_object_release( p_sd );
         return VLC_EGENERIC;
     }
     return VLC_SUCCESS;
@@ -143,7 +143,7 @@ services_discovery_GetLocalizedName ( services_discovery_t * p_sd )
 void
 services_discovery_SetLocalizedName ( services_discovery_t * p_sd, const char *psz )
 {
-    if(p_sd->psz_localized_name) free( p_sd->psz_localized_name );
+    free( p_sd->psz_localized_name );
     p_sd->psz_localized_name = strdup(psz);
 }
 
@@ -234,8 +234,11 @@ static void playlist_sd_item_added( const vlc_event_t * p_event, void * user_dat
 
     p_new_item = playlist_NodeAddInput( p_parent->p_playlist, p_input, p_parent,
                                         PLAYLIST_APPEND, PLAYLIST_END, VLC_FALSE );
-    p_new_item->i_flags &= ~PLAYLIST_SKIP_FLAG;
-    p_new_item->i_flags &= ~PLAYLIST_SAVE_FLAG;
+    if( p_new_item )
+    {
+        p_new_item->i_flags &= ~PLAYLIST_SKIP_FLAG;
+        p_new_item->i_flags &= ~PLAYLIST_SAVE_FLAG;
+    }
 }
 
  /* A new item has been removed from a certain sd */