]> git.sesse.net Git - vlc/commitdiff
Extensions: fix leak: free commands
authorJean-Philippe André <jpeg@videolan.org>
Thu, 4 Feb 2010 02:29:37 +0000 (03:29 +0100)
committerJean-Philippe André <jpeg@videolan.org>
Thu, 4 Feb 2010 02:30:44 +0000 (03:30 +0100)
modules/misc/lua/extension_thread.c

index 638b9669ee2cd44bb56d7a513cde661af68d498a..cadfc3acc1fc17d633d4fac1b2f16fa2420564e1 100644 (file)
@@ -285,6 +285,7 @@ static void* Run( void *data )
         if( cmd )
         {
             p_ext->p_sys->command = cmd->next;
+            cmd->next = NULL; // This prevents FreeCommands from freeing next
         }
 
         vlc_mutex_unlock( &p_ext->p_sys->command_lock );
@@ -346,7 +347,6 @@ static void* Run( void *data )
                         msg_Dbg( p_mgr, "Trigger menu %d of '%s'",
                                  *pi_id, p_ext->psz_name );
                         lua_ExtensionTriggerMenu( p_mgr, p_ext, *pi_id );
-                        free( pi_id );
                         break;
                     }
 
@@ -373,6 +373,8 @@ static void* Run( void *data )
             }
         }
 
+        FreeCommands( cmd );
+
         vlc_mutex_lock( &p_ext->p_sys->command_lock );
         if( !p_ext->p_sys->b_exiting && !p_ext->p_sys->command )
         {