]> git.sesse.net Git - vlc/commitdiff
lua: fix potential leak (and missing unlock).
authorRémi Duraffort <ivoire@videolan.org>
Tue, 26 Jan 2010 21:38:37 +0000 (22:38 +0100)
committerRémi Duraffort <ivoire@videolan.org>
Tue, 26 Jan 2010 21:50:37 +0000 (22:50 +0100)
modules/misc/lua/extension_thread.c
modules/misc/lua/libs/dialog.c

index 2ccfdbb0f80d35ae985fb100fcd27117aa2466e4..56612112444ef28e65218dbad4b71c16e13d7385 100644 (file)
@@ -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;
             }
index e463e301c5844784c1e215bb78aef7cce4963002..d0702c346eb6562167df0ab2eb426e347b85bb72 100644 (file)
@@ -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 );