aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/init_wslua.c
diff options
context:
space:
mode:
authorHadriel Kaplan <hadrielk@yahoo.com>2014-01-31 02:25:42 -0500
committerEvan Huus <eapache@gmail.com>2014-01-31 16:31:59 +0000
commit3d59ff9e95aab13cadd046afcc36cb8c290b6e62 (patch)
treea1a49ef007d737f86dba0a9a8f73100e4fb4815f /epan/wslua/init_wslua.c
parenta94d127b771da2a7353ad26d8a70c4fe2cbc32fe (diff)
Fix for Bug-9711 Lua: the Lua stack is growing slightly during initialization.
Change-Id: I689319c0071fdb42583e8bd7633d8f0660c92f1b Reviewed-on: https://code.wireshark.org/review/51 Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/wslua/init_wslua.c')
-rw-r--r--epan/wslua/init_wslua.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/epan/wslua/init_wslua.c b/epan/wslua/init_wslua.c
index 40fa7d01c8..5bcc660ccd 100644
--- a/epan/wslua/init_wslua.c
+++ b/epan/wslua/init_wslua.c
@@ -263,6 +263,7 @@ static gboolean lua_load_script(const gchar* filename) {
case 0:
lua_pcall(L,0,0,1);
fclose(file);
+ lua_pop(L,1); /* pop the error handler */
return TRUE;
case LUA_ERRSYNTAX: {
report_failure("Lua: syntax error during precompilation of `%s':\n%s",filename,lua_tostring(L,-1));
@@ -470,6 +471,7 @@ int wslua_init(register_cb cb, gpointer client_data) {
L = NULL;
return 0;
}
+ lua_pop(L,1); /* pop the getglobal result */
/* load global scripts */
lua_load_plugins(get_plugin_dir(), cb, client_data, FALSE);
@@ -480,6 +482,7 @@ int wslua_init(register_cb cb, gpointer client_data) {
if (lua_isboolean(L,-1) && lua_toboolean(L,-1)) {
run_anyway = TRUE;
}
+ lua_pop(L,1); /* pop the getglobal result */
/* if we are indeed superuser run user scripts only if told to do so */
if ( (!started_with_special_privs()) || run_anyway ) {