vlc | branch: master | Julien 'Lta' BALLET <cont...@lta.io> | Tue Jan 21 
11:11:09 2014 +0100| [dcdfe4ae1fc608e489b5291c7d2b16a14237ecc4] | committer: 
Jean-Baptiste Kempf

Fix a segfault in LUA Service Discovery, when stack wasn't a clean state after 
the first iteration of the FillDescriptor loop

Signed-off-by: Jean-Baptiste Kempf <j...@videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=dcdfe4ae1fc608e489b5291c7d2b16a14237ecc4
---

 modules/lua/services_discovery.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/modules/lua/services_discovery.c b/modules/lua/services_discovery.c
index 8aa4115..c81d31b 100644
--- a/modules/lua/services_discovery.c
+++ b/modules/lua/services_discovery.c
@@ -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;
 

_______________________________________________
vlc-commits mailing list
vlc-commits@videolan.org
https://mailman.videolan.org/listinfo/vlc-commits

Reply via email to