Commit 4106f477 authored by Jean-Philippe André's avatar Jean-Philippe André

Extensions: fix a leak (and a potential crash)

parent 45ea8ad0
...@@ -277,9 +277,11 @@ int __PushCommand( extension_t *p_ext, bool b_unique, int i_command, ...@@ -277,9 +277,11 @@ int __PushCommand( extension_t *p_ext, bool b_unique, int i_command,
} }
if( !b_skip ) if( !b_skip )
{ {
if( !b_unique || ( last->i_command != i_command ) last->next = cmd;
|| memcmp( last->data, cmd->data, sizeof( cmd->data ) ) != 0 ) }
last->next = cmd; else
{
FreeCommands( cmd );
} }
} }
...@@ -394,8 +396,9 @@ static void* Run( void *data ) ...@@ -394,8 +396,9 @@ static void* Run( void *data )
} }
vlc_mutex_lock( &p_ext->p_sys->command_lock ); 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; p_ext->p_sys->command = cmd->next;
cmd->next = NULL; // This prevents FreeCommands from freeing next cmd->next = NULL; // This prevents FreeCommands from freeing next
FreeCommands( cmd ); FreeCommands( cmd );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment