[vlc-devel] commit: Fix memleaks in stream output. ( Rémi Duraffort )

git version control git at videolan.org
Thu Jul 31 15:47:55 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Thu Jul 31 15:50:47 2008 +0200| [6b90843041ecdf3ae0bde9ce27a1d8327de56f48]

Fix memleaks in stream output.

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

 modules/stream_out/standard.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/modules/stream_out/standard.c b/modules/stream_out/standard.c
index 72b97e7..a7c5d24 100644
--- a/modules/stream_out/standard.c
+++ b/modules/stream_out/standard.c
@@ -217,7 +217,11 @@ static int Open( vlc_object_t *p_this )
         free( val.psz_string );
 
     p_sys = p_stream->p_sys = malloc( sizeof( sout_stream_sys_t) );
-    if( !p_sys ) return VLC_ENOMEM;
+    if( !p_sys )
+    {
+        free( psz_url );
+        return VLC_ENOMEM;
+    }
     p_stream->p_sys->p_session = NULL;
 
     msg_Dbg( p_this, "creating `%s/%s://%s'", psz_access, psz_mux, psz_url );
@@ -278,6 +282,7 @@ static int Open( vlc_object_t *p_this )
         else
         {
             msg_Err( p_stream, "no access _and_ no muxer (fatal error)" );
+            free( psz_url );
             free( p_sys );
             return VLC_EGENERIC;
         }
@@ -370,6 +375,7 @@ static int Open( vlc_object_t *p_this )
                  psz_access, psz_mux, psz_url );
         free( psz_access );
         free( psz_mux );
+        free( psz_url );
         free( p_sys );
         return VLC_EGENERIC;
     }
@@ -385,6 +391,7 @@ static int Open( vlc_object_t *p_this )
         sout_AccessOutDelete( p_access );
         free( psz_access );
         free( psz_mux );
+        free( psz_url );
         free( p_sys );
         return VLC_EGENERIC;
     }




More information about the vlc-devel mailing list