[vlc-devel] commit: Fix memleaks and one potential memleak ( and move a test where it might be) ( Rémi Duraffort )

git version control git at videolan.org
Wed Aug 20 20:10:49 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Aug 20 19:53:59 2008 +0200| [558e2336eba38c3215264475c6e580c15bde758e] | committer: Rémi Duraffort 

Fix memleaks and one potential memleak (and move a test where it might be)

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

 modules/access_output/shout.c |   16 ++++++++++++----
 1 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/modules/access_output/shout.c b/modules/access_output/shout.c
index ad72311..c51704a 100644
--- a/modules/access_output/shout.c
+++ b/modules/access_output/shout.c
@@ -183,10 +183,6 @@ static int Open( vlc_object_t *p_this )
 
     config_ChainParse( p_access, SOUT_CFG_PREFIX, ppsz_sout_options, p_access->p_cfg );
 
-    psz_accessname = psz_parser = strdup( p_access->psz_path );
-    if( !psz_parser )
-        return VLC_ENOMEM;
-
     if( !p_access->psz_path )
     {
         msg_Err( p_access,
@@ -194,6 +190,10 @@ static int Open( vlc_object_t *p_this )
         return VLC_EGENERIC;
     }
 
+    psz_accessname = psz_parser = strdup( p_access->psz_path );
+    if( !psz_parser )
+        return VLC_ENOMEM;
+
     /* Parse connection data user:pwd at host:port/mountpoint */
     psz_user = psz_parser;
     while( psz_parser[0] && psz_parser[0] != ':' ) psz_parser++;
@@ -262,6 +262,10 @@ static int Open( vlc_object_t *p_this )
                  psz_host, i_port, psz_mount );
         free( p_access->p_sys );
         free( psz_accessname );
+        free( psz_name );
+        free( psz_description );
+        free( psz_genre );
+        free( psz_url );
         return VLC_EGENERIC;
     }
 
@@ -293,6 +297,7 @@ static int Open( vlc_object_t *p_this )
         if( i_ret != SHOUTERR_SUCCESS )
         {
             msg_Err( p_access, "failed to set the information about the bitrate" );
+            free( val.psz_string );
             free( p_access->p_sys );
             free( psz_accessname );
             return VLC_EGENERIC;
@@ -318,6 +323,7 @@ static int Open( vlc_object_t *p_this )
         if( i_ret != SHOUTERR_SUCCESS )
         {
             msg_Err( p_access, "failed to set the information about the samplerate" );
+            free( val.psz_string );
             free( p_access->p_sys );
             free( psz_accessname );
             return VLC_EGENERIC;
@@ -333,6 +339,7 @@ static int Open( vlc_object_t *p_this )
         if( i_ret != SHOUTERR_SUCCESS )
         {
             msg_Err( p_access, "failed to set the information about the number of channels" );
+            free( val.psz_string );
             free( p_access->p_sys );
             free( psz_accessname );
             return VLC_EGENERIC;
@@ -348,6 +355,7 @@ static int Open( vlc_object_t *p_this )
         if( i_ret != SHOUTERR_SUCCESS )
         {
             msg_Err( p_access, "failed to set the information about Ogg Vorbis quality" );
+            free( val.psz_string );
             free( p_access->p_sys );
             free( psz_accessname );
             return VLC_EGENERIC;




More information about the vlc-devel mailing list