Commit a67d563f authored by ivoire's avatar ivoire
Browse files

lua: fix potential leak (and missing unlock).

parent f741dd1b
......@@ -222,7 +222,12 @@ int PushCommand( extension_t *p_ext,
case CMD_TRIGGERMENU:
{
int *pi = malloc( sizeof( int ) );
if( !pi ) return VLC_ENOMEM;
if( !pi )
{
free( cmd );
vlc_mutex_unlock( &p_ext->p_sys->command_lock );
return VLC_ENOMEM;
}
*pi = va_arg( args, int );
cmd->data[0] = pi;
}
......
......@@ -163,7 +163,10 @@ static int vlclua_dialog_create( lua_State *L )
lua_getglobal( L, "vlc" );
lua_getfield( L, -1, "__dialog" );
if( lua_topointer( L, lua_gettop( L ) ) != NULL )
{
free( p_dlg );
return luaL_error( L, "Only one dialog allowed per extension!" );
}
p_dlg->p_object = p_this;
p_dlg->psz_title = strdup( psz_title );
......
Supports Markdown
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