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

Julien 'Lta' BALLET git at videolan.org
Tue Jan 21 16:11:53 CET 2014


vlc | branch: master | Julien 'Lta' BALLET <contact at 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 <jb at 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;
 



More information about the vlc-commits mailing list