]> git.sesse.net Git - vlc/blobdiff - modules/stream_out/standard.c
Fix memleaks in stream output.
[vlc] / modules / stream_out / standard.c
index 6b97d20af2ce44b739b38b2c01d5965075cc599b..a7c5d24904372fd5d21905f1c3e227ed80dc2712 100644 (file)
@@ -32,7 +32,7 @@
 # define _WIN32_WINNT 0x0501
 #endif
 
-#include <vlc/vlc.h>
+#include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_sout.h>
 
@@ -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,8 @@ 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;
         }
     }
@@ -300,6 +306,7 @@ static int Open( vlc_object_t *p_this )
         else
         {
             msg_Err( p_stream, "no mux specified or found by extension" );
+            free( p_sys );
             return VLC_EGENERIC;
         }
     }
@@ -368,6 +375,8 @@ 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;
     }
     msg_Dbg( p_stream, "access opened" );
@@ -382,6 +391,8 @@ 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;
     }
     msg_Dbg( p_stream, "mux opened" );