]> source.dussan.org Git - rspamd.git/commitdiff
Fix lua worker.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 12 Mar 2015 16:12:02 +0000 (16:12 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Thu, 12 Mar 2015 16:12:02 +0000 (16:12 +0000)
src/lua_worker.c

index 95c3be71910aed461adba3f4c2e27cc958fbc7af..a93a2c2fa7ed015bbf20f50f46396bff7bcaada8 100644 (file)
@@ -262,7 +262,7 @@ lua_accept_socket (gint fd, short what, void *arg)
        struct rspamd_lua_worker_ctx *ctx, **pctx;
        gint nfd;
        lua_State *L;
-       rspamd_inet_addr_t addr;
+       rspamd_inet_addr_t *addr;
 
        ctx = worker->ctx;
        L = ctx->L;
@@ -278,8 +278,8 @@ lua_accept_socket (gint fd, short what, void *arg)
        }
 
        msg_info ("accepted connection from %s port %d",
-               rspamd_inet_address_to_string (&addr),
-               rspamd_inet_address_get_port (&addr));
+               rspamd_inet_address_to_string (addr),
+               rspamd_inet_address_get_port (addr));
 
        /* Call finalizer function */
        lua_rawgeti (L, LUA_REGISTRYINDEX, ctx->cbref_accept);
@@ -287,13 +287,15 @@ lua_accept_socket (gint fd, short what, void *arg)
        rspamd_lua_setclass (L, "rspamd{worker}", -1);
        *pctx = ctx;
        lua_pushinteger (L, nfd);
-       lua_pushstring (L, rspamd_inet_address_to_string (&addr));
+       lua_pushstring (L, rspamd_inet_address_to_string (addr));
        lua_pushinteger (L, 0);
 
 
        if (lua_pcall (L, 4, 0, 0) != 0) {
                msg_info ("call to worker accept failed: %s", lua_tostring (L, -1));
        }
+
+       rspamd_inet_address_destroy (addr);
 }
 
 static gboolean