[vlc-devel] commit: visual: fix potential memleak. ( Rémi Duraffort )

git version control git at videolan.org
Wed Mar 25 15:23:14 CET 2009


vlc | branch: master | Rémi Duraffort <ivoire at videolan.org> | Wed Mar 25 15:22:45 2009 +0100| [f7f6561b34c62511983592ed1ce430c85a380ba7] | committer: Rémi Duraffort 

visual: fix potential memleak.

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

 modules/visualization/visual/visual.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/modules/visualization/visual/visual.c b/modules/visualization/visual/visual.c
index 3ee95a8..4702a98 100644
--- a/modules/visualization/visual/visual.c
+++ b/modules/visualization/visual/visual.c
@@ -260,6 +260,8 @@ static int Open( vlc_object_t *p_this )
                 if( ( psz_eoa = strchr( psz_parser, '}') ) == NULL )
                 {
                    msg_Err( p_filter, "unable to parse effect list. Aborting");
+                   free( p_effect->psz_name );
+                   free( p_effect );
                    break;
                 }
                 p_effect->psz_args =
@@ -309,6 +311,13 @@ static int Open( vlc_object_t *p_this )
     if( p_sys->p_vout == NULL )
     {
         msg_Err( p_filter, "no suitable vout module" );
+        for( int i = 0; i < p_sys->i_effect; i++ )
+        {
+            free( p_sys->effect[i]->psz_name );
+            free( p_sys->effect[i]->psz_args );
+            free( p_sys->effect[i] );
+        }
+        free( p_sys->effect );
         free( p_sys );
         return VLC_EGENERIC;
     }




More information about the vlc-devel mailing list