[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 12:13:08 CEST 2010


vlc/vlc-1.1 | branch: master | Jean-Philippe André <jpeg at videolan.org> | Wed May  5 18:10:59 2010 +0800| [72ae8773514fe1769fa1d2359edd0f8ad66f7aef] | committer: Jean-Baptiste Kempf 

Extensions: fix a leak (and a potential crash)
(cherry picked from commit 4106f477c6f967e369afc84e64538add1ccce64b)

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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