[vlc-commits] commit: Extensions: fix a leak (and a potential crash) ( Jean-Philippe André )

git at videolan.org git at videolan.org
Wed May 5 11:23:18 CEST 2010


vlc | branch: master | Jean-Philippe André <jpeg at videolan.org> | Wed May  5 18:10:59 2010 +0800| [4106f477c6f967e369afc84e64538add1ccce64b] | committer: Jean-Philippe André 

Extensions: fix a leak (and a potential crash)

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

 modules/misc/lua/extension_thread.c |   11 +++++++----
 1 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/modules/misc/lua/extension_thread.c b/modules/misc/lua/extension_thread.c
index 34694e8..9df6bbd 100644
--- a/modules/misc/lua/extension_thread.c
+++ b/modules/misc/lua/extension_thread.c
@@ -277,9 +277,11 @@ int __PushCommand( extension_t *p_ext,  bool b_unique, int i_command,
         }
         if( !b_skip )
         {
-            if( !b_unique || ( last->i_command != i_command )
-                || memcmp( last->data, cmd->data, sizeof( cmd->data ) ) != 0 )
-                last->next = cmd;
+            last->next = cmd;
+        }
+        else
+        {
+            FreeCommands( cmd );
         }
     }
 
@@ -394,8 +396,9 @@ static void* Run( void *data )
         }
 
         vlc_mutex_lock( &p_ext->p_sys->command_lock );
-        if( cmd )
+        if( p_ext->p_sys->command )
         {
+            cmd = p_ext->p_sys->command;
             p_ext->p_sys->command = cmd->next;
             cmd->next = NULL; // This prevents FreeCommands from freeing next
             FreeCommands( cmd );



More information about the vlc-commits mailing list