[vlc-devel] commit: Fix memleak and bad use of a const variable. ( Rémi Duraffort )

git version control git at videolan.org
Sun Aug 3 19:40:20 CEST 2008


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Sun Aug  3 19:42:19 2008 +0200| [303e9b5405a9a4c0e9c428425a224d65797d6c18] | committer: Rémi Duraffort 

Fix memleak and bad use of a const variable.

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

 src/misc/filter_chain.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/misc/filter_chain.c b/src/misc/filter_chain.c
index a89c288..808b6b6 100644
--- a/src/misc/filter_chain.c
+++ b/src/misc/filter_chain.c
@@ -214,10 +214,11 @@ static int filter_chain_AppendFromStringInternal( filter_chain_t *p_chain,
 {
     config_chain_t *p_cfg = NULL;
     char *psz_name = NULL;
+    char* psz_new_string;
 
     if( !psz_string || !*psz_string ) return 0;
 
-    psz_string = config_ChainCreate( &psz_name, &p_cfg, psz_string );
+    psz_new_string = config_ChainCreate( &psz_name, &p_cfg, psz_string );
 
     filter_t *p_filter = filter_chain_AppendFilterInternal( p_chain, psz_name,
                                                             p_cfg, NULL, NULL );
@@ -227,11 +228,13 @@ static int filter_chain_AppendFromStringInternal( filter_chain_t *p_chain,
                  "to filter chain", psz_name );
         free( psz_name );
         free( p_cfg );
+        free( psz_new_string );
         return -1;
     }
     free( psz_name );
 
-    int ret = filter_chain_AppendFromStringInternal( p_chain, psz_string );
+    int ret = filter_chain_AppendFromStringInternal( p_chain, psz_new_string );
+    free( psz_new_string );
     if( ret < 0 )
     {
         filter_chain_DeleteFilterInternal( p_chain, p_filter );




More information about the vlc-devel mailing list