]> git.sesse.net Git - vlc/commitdiff
Extensions: fix a leak (and a potential crash)
authorJean-Philippe André <jpeg@videolan.org>
Wed, 5 May 2010 10:10:59 +0000 (18:10 +0800)
committerJean-Philippe André <jpeg@videolan.org>
Wed, 5 May 2010 10:10:59 +0000 (18:10 +0800)
modules/misc/lua/extension_thread.c

index 34694e8618bbcd9f5b0fe3cc05c0beaa6ef3c077..9df6bbd18fb7221bfcbaf34cec9271dcb91a7b01 100644 (file)
@@ -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 );