From: Vsevolod Stakhov Date: Mon, 12 Mar 2018 15:44:58 +0000 (+0000) Subject: [Minor] Fix table argument parsing X-Git-Tag: 1.7.0~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=3f86aa3aafbc193460cab91ec1657dba0dee1433;p=thirdparty%2Frspamd.git [Minor] Fix table argument parsing --- diff --git a/src/lua/lua_upstream.c b/src/lua/lua_upstream.c index 680b2c61bf..e403d34af6 100644 --- a/src/lua/lua_upstream.c +++ b/src/lua/lua_upstream.c @@ -210,15 +210,17 @@ lua_upstream_list_create (lua_State *L) rspamd_lua_setclass (L, "rspamd{upstream_list}", -1); *pnew = new; + lua_pushvalue (L, top); + for (lua_pushnil (L); lua_next (L, -2); lua_pop (L, 1)) { def = lua_tostring (L, -1); if (!def || !rspamd_upstreams_parse_line (new, def, default_port, NULL)) { - rspamd_upstreams_destroy (new); - msg_warn ("cannot parse %s", def); - lua_pushnil (L); + msg_warn ("cannot parse upstream %s", def); } } + + lua_pop (L, 1); } else { return luaL_error (L, "invalid arguments");