Commit 72ae8773 authored by Jean-Philippe André's avatar Jean-Philippe André Committed by Jean-Baptiste Kempf

Extensions: fix a leak (and a potential crash)

(cherry picked from commit 4106f477c6f967e369afc84e64538add1ccce64b)
Signed-off-by: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent 767b832c
......@@ -277,10 +277,12 @@ 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;
}
else
{
FreeCommands( cmd );
}
}
vlc_cond_signal( &p_ext->p_sys->wait );
......@@ -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 );
......
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