vlc | branch: master | Rémi Denis-Courmont <[email protected]> | Sat Jul 8 16:49:31 2017 +0300| [1ba591f0537b1fc2b37cc03da8c5c23ffdeb222e] | committer: Rémi Denis-Courmont
demux: fix multiple frees > http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=1ba591f0537b1fc2b37cc03da8c5c23ffdeb222e --- src/input/demux.c | 10 +--------- src/input/input.c | 19 ++++++++++++------- 2 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/input/demux.c b/src/input/demux.c index f0a7b76912..f8cac46438 100644 --- a/src/input/demux.c +++ b/src/input/demux.c @@ -689,8 +689,6 @@ demux_t *demux_FilterChainNew( demux_t *p_demux, const char *psz_chain ) } size_t i = vlc_array_count(&name); - vlc_array_t module; - vlc_array_init(&module); while(i--) { const char *p_name = vlc_array_item_at_index(&name, i); @@ -698,22 +696,16 @@ demux_t *demux_FilterChainNew( demux_t *p_demux, const char *psz_chain ) if(!p_next) goto error; - vlc_array_append(&module, p_next); p_demux = p_next; } vlc_array_clear(&name); - vlc_array_clear(&module); return p_demux; error: i++; /* last module couldn't be created */ - /* destroy all modules created, starting with the last one */ - int modules = vlc_array_count(&module); - while(modules--) - demux_Delete(vlc_array_item_at_index(&module, modules)); - vlc_array_clear(&module); + demux_Delete(p_demux); while(i--) free(vlc_array_item_at_index(&name, i)); diff --git a/src/input/input.c b/src/input/input.c index 665a25986f..7b1b24d64a 100644 --- a/src/input/input.c +++ b/src/input/input.c @@ -2466,13 +2466,18 @@ static input_source_t *InputSourceNew( input_thread_t *p_input, } char *psz_demux_chain = var_GetNonEmptyString(p_input, "demux-filter"); - /* add the chain of demux filters */ - demux_t *p_filtered_demux = demux_FilterChainNew( in->p_demux, psz_demux_chain ); - if ( p_filtered_demux != NULL ) - in->p_demux = p_filtered_demux; - else if ( psz_demux_chain != NULL ) - msg_Dbg(p_input, "Failed to create demux filter %s", psz_demux_chain); - free( psz_demux_chain ); + if( psz_demux_chain != NULL ) /* add the chain of demux filters */ + { + in->p_demux = demux_FilterChainNew( in->p_demux, psz_demux_chain ); + free( psz_demux_chain ); + + if( in->p_demux == NULL ) + { + msg_Err(p_input, "Failed to create demux filter"); + vlc_object_release( in ); + return NULL; + } + } /* Get infos from (access_)demux */ bool b_can_seek; _______________________________________________ vlc-commits mailing list [email protected] https://mailman.videolan.org/listinfo/vlc-commits
