Fix a segfault in LUA Service Discovery, when stack wasn't a clean state after the...
authorJulien 'Lta' BALLET <contact@lta.io>
Tue, 21 Jan 2014 10:11:09 +0000 (11:11 +0100)
committerJean-Baptiste Kempf <jb@videolan.org>
Tue, 21 Jan 2014 15:13:31 +0000 (16:13 +0100)
Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
modules/lua/services_discovery.c

index 8aa4115..c81d31b 100644 (file)
@@ -316,6 +316,7 @@ static int FillDescriptor( services_discovery_t *p_sd,
 
     /* Create a new lua thread */
     lua_State *L = luaL_newstate();
+
     if( luaL_dofile( L, p_sys->psz_filename ) )
     {
         msg_Err( p_sd, "Error loading script %s: %s", p_sys->psz_filename,
@@ -366,11 +367,15 @@ static int FillDescriptor( services_discovery_t *p_sd,
                     break;
                 }
             }
+
+            lua_pop( L, 1 );
+
             if( !psz_iter )
                 msg_Warn( p_sd, "Services discovery capability '%s' unknown in "
                                 "script '%s'", psz_cap, p_sys->psz_filename );
         }
     }
+
     lua_pop( L, 1 );
     i_ret = VLC_SUCCESS;