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

Filip Roséen git at videolan.org
Tue Sep 27 11:14:01 CEST 2016


vlc | branch: master | Filip Roséen <filip at atch.se> | Tue Sep 27 11:11:48 2016 +0200| [2366ad0e189e29a97322f5c7f247f7e6ffc3cbbd] | committer: Thomas Guillem

misc/filter_chain: fixup of commit 2875395

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!

Signed-off-by: Thomas Guillem <thomas at gllm.fr>

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

 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;
         }
 



More information about the vlc-commits mailing list