+ rss_feed_t *p_feed = p_feeds + i_feed;
+ rss_feed_t *p_old_feed = p_sys->p_feeds + i_feed;
+
+ /* Initialize the structure */
+ p_feed->psz_title = NULL;
+ p_feed->psz_description = NULL;
+ p_feed->psz_link = NULL;
+ p_feed->psz_image = NULL;
+ p_feed->p_pic = NULL;
+ p_feed->i_items = 0;
+ p_feed->p_items = NULL;
+
+ p_feed->psz_url = strdup( p_old_feed->psz_url );
+
+ /* Fetch the feed */
+ msg_Dbg( p_filter, "opening %s RSS/Atom feed ...", p_feed->psz_url );
+
+ p_stream = stream_UrlNew( p_filter, p_feed->psz_url );
+ if( !p_stream )
+ {
+ msg_Err( p_filter, "Failed to open %s for reading", p_feed->psz_url );
+ p_xml_reader = NULL;
+ goto error;
+ }
+
+ p_xml_reader = xml_ReaderCreate( p_xml, p_stream );
+ if( !p_xml_reader )
+ {
+ msg_Err( p_filter, "Failed to open %s for parsing", p_feed->psz_url );
+ goto error;
+ }
+
+ /* Parse the feed */
+ if( !ParseFeed( p_filter, p_xml_reader, p_feed ) )
+ goto error;
+
+ /* If we have a image: load it if requiere */
+ if( b_images && p_feed->psz_image && !p_feed->p_pic )
+ {
+ p_feed->p_pic = LoadImage( p_filter, p_feed->psz_image );
+ }
+
+ msg_Dbg( p_filter, "done with %s RSS/Atom feed", p_feed->psz_url );
+ xml_ReaderDelete( p_xml_reader );
+ stream_Delete( p_stream );
+ }
+
+ xml_Delete( p_xml );
+ return p_feeds;
+
+error:
+ FreeRSS( p_feeds, i_feed + 1 );
+ if( p_xml_reader )
+ xml_ReaderDelete( p_xml_reader );
+ if( p_stream )
+ stream_Delete( p_stream );
+ if( p_xml )
+ xml_Delete( p_xml );
+
+ return NULL;
+}
+
+/****************************************************************************
+ * FreeRSS
+ ***************************************************************************/
+static void FreeRSS( rss_feed_t *p_feeds, int i_feeds )
+{
+ for( int i_feed = 0; i_feed < i_feeds; i_feed++ )
+ {
+ rss_feed_t *p_feed = p_feeds+i_feed;
+ for( int i_item = 0; i_item < p_feed->i_items; i_item++ )