[vlc-devel] commit: Fix a lot of memleaks (and CID 68 in the same time). ( Rémi Duraffort )

git version control git at videolan.org
Mon Oct 6 21:03:08 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Mon Oct  6 20:56:01 2008 +0200| [f2157f9df9e46f7864f67b3163e235e96bcc1185] | committer: Rémi Duraffort 

Fix a lot of memleaks (and CID 68 in the same time).
Also #undef some local macros.
Still a lot of potential memleaks.

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

 modules/demux/playlist/podcast.c |   11 ++++++++++-
 1 files changed, 10 insertions(+), 1 deletions(-)

diff --git a/modules/demux/playlist/podcast.c b/modules/demux/playlist/podcast.c
index 8dadc14..c33eb13 100644
--- a/modules/demux/playlist/podcast.c
+++ b/modules/demux/playlist/podcast.c
@@ -180,21 +180,25 @@ static int Demux( demux_t *p_demux )
                     {
                         free( psz_name );
                         free( psz_value );
+                        free( psz_elname );
                         return -1;
                     }
                     if( !strcmp( psz_elname, "enclosure" ) &&
                         !strcmp( psz_name, "url" ) )
                     {
+                        free( psz_item_mrl );
                         psz_item_mrl = strdup( psz_value );
                     }
                     else if( !strcmp( psz_elname, "enclosure" ) &&
                         !strcmp( psz_name, "length" ) )
                     {
+                        free( psz_item_size );
                         psz_item_size = strdup( psz_value );
                     }
                     else if( !strcmp( psz_elname, "enclosure" ) &&
                         !strcmp( psz_name, "type" ) )
                     {
+                        free( psz_item_type );
                         psz_item_type = strdup( psz_value );
                     }
                     else
@@ -237,6 +241,7 @@ static int Demux( demux_t *p_demux )
                 SET_DATA( psz_item_duration, "itunes:duration" )
                 SET_DATA( psz_item_keywords, "itunes:keywords" )
                 SET_DATA( psz_item_subtitle, "itunes:subtitle" )
+#undef SET_DATA
                 /* toplevel meta data */
                 else if( b_item == false && b_image == false
                          && !strcmp( psz_elname, "title" ) )
@@ -283,6 +288,7 @@ static int Demux( demux_t *p_demux )
                     if( psz_item_mrl == NULL )
                     {
                         msg_Err( p_demux, "invalid XML (no enclosure markup)" );
+                        free( psz_elname );
                         return -1;
                     }
                     p_input = input_item_NewExt( p_demux, psz_item_mrl,
@@ -299,6 +305,7 @@ static int Demux( demux_t *p_demux )
                     ADD_INFO( "Podcast Subtitle", psz_item_subtitle );
                     ADD_INFO( "Podcast Summary", psz_item_summary );
                     ADD_INFO( "Podcast Type", psz_item_type );
+#undef ADD_INFO
                     if( psz_item_size )
                     {
                         input_item_AddInfo( p_input,
@@ -327,7 +334,7 @@ static int Demux( demux_t *p_demux )
                     b_image = false;
                 }
                 free( psz_elname );
-                psz_elname = strdup("");
+                psz_elname = strdup( "" );
 
                 break;
             }
@@ -339,6 +346,8 @@ static int Demux( demux_t *p_demux )
         msg_Warn( p_demux, "error while parsing data" );
     }
 
+    free( psz_elname );
+
     HANDLE_PLAY_AND_RELEASE;
     return 0; /* Needed for correct operation of go back */
 }




More information about the vlc-devel mailing list