[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
Wed Jan 22 11:21:30 CET 2014


vlc/vlc-2.1 | branch: master | Julien 'Lta' BALLET <contact at lta.io> | Tue Jan 21 11:11:09 2014 +0100| [13cb6cd1dfdf08b6fa7ae93a66ba4fd9738800d6] | 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>
(cherry picked from commit 294c97cd9d95d81465c0e1b2b319428301f3d4aa)
Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

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

 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 7cd0bd6..b52011d 100644
--- a/modules/lua/services_discovery.c
+++ b/modules/lua/services_discovery.c
@@ -322,6 +322,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,
@@ -372,11 +373,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