[vlc-devel] [PATCH] misc/filter_chain: fixup of commit 2875395

Filip Roséen filip at atch.se
Tue Sep 27 11:11:48 CEST 2016


The referred to commit assumed that filter->p_cfg always referred to an object
allocated through config_ChainCreate and that ownership was meant to be passed
with values ending up in the data-member (something which is not true).

These changes moves the clean-up to a more appropriate location, while
also making sure that we actually free the allocated data on error in
filter_chain_AppendFromString.

fixes #17429

--

Thanks to Robux4 for letting me know about this issue!
---
 src/misc/filter_chain.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index df71fa4..ca4be4e 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -288,9 +288,6 @@ void filter_chain_DeleteFilter( filter_chain_t *chain, filter_t *filter )
     es_format_Clean( &filter->fmt_out );
     es_format_Clean( &filter->fmt_in );
 
-    if( filter->p_cfg )
-        config_ChainDestroy( filter->p_cfg );
-
     vlc_object_release( filter );
     /* FIXME: check fmt_in/fmt_out consitency */
 }
@@ -315,11 +312,13 @@ int filter_chain_AppendFromString( filter_chain_t *chain, const char *str )
 
         filter_t *filter = filter_chain_AppendFilter( chain, name, cfg,
                                                       NULL, NULL );
+        if( cfg )
+            config_ChainDestroy( cfg );
+
         if( filter == NULL )
         {
             msg_Err( obj, "Failed to append '%s' to chain", name );
             free( name );
-            free( cfg );
             goto error;
         }
 
-- 
2.10.0



More information about the vlc-devel mailing list