[vlc-devel] commit: Fix double free after stream_out creation failed ( Rafaël Carré )

git version control git at videolan.org
Sun Jan 17 11:44:41 CET 2010


vlc | branch: master | Rafaël Carré <rafael.carre at gmail.com> | Sun Jan 17 11:43:53 2010 +0100| [b598703a0063ebee2706cc9ca8fca80504569e82] | committer: Rafaël Carré 

Fix double free after stream_out creation failed

Also fix a use after free

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

 src/stream_output/stream_output.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c
index 3fec92d..32b64cc 100644
--- a/src/stream_output/stream_output.c
+++ b/src/stream_output/stream_output.c
@@ -124,8 +124,8 @@ sout_instance_t *__sout_NewInstance( vlc_object_t *p_parent, const char *psz_des
         return p_sout;
     }
 
-    free( psz_chain );
     msg_Err( p_sout, "stream chain failed for `%s'", psz_chain );
+    free( psz_chain );
 
     FREENULL( p_sout->psz_sout );
 
@@ -859,6 +859,10 @@ static sout_stream_t *sout_StreamNew( sout_instance_t *p_sout, char *psz_name,
 
     if( !p_stream->p_module )
     {
+        /* those must be freed by the caller if creation failed */
+        p_stream->psz_name = NULL;
+        p_stream->p_cfg = NULL;
+
         sout_StreamDelete( p_stream );
         return NULL;
     }




More information about the vlc-devel mailing list