From b598703a0063ebee2706cc9ca8fca80504569e82 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Rafa=C3=ABl=20Carr=C3=A9?= Date: Sun, 17 Jan 2010 11:43:53 +0100 Subject: [PATCH] Fix double free after stream_out creation failed Also fix a use after free --- src/stream_output/stream_output.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/stream_output/stream_output.c b/src/stream_output/stream_output.c index 3fec92dfbb..32b64ccfed 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; } -- 2.39.2