]> git.ipfire.org Git - thirdparty/rspamd.git/commitdiff
[Minor] Fix table argument parsing
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Mar 2018 15:44:58 +0000 (15:44 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 12 Mar 2018 15:44:58 +0000 (15:44 +0000)
src/lua/lua_upstream.c

index 680b2c61bf973113e88544d69870170c50f3ff40..e403d34af6d8fa906859776b423a89c73a9a6e8d 100644 (file)
@@ -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");