From: Aki Tuomi Date: Mon, 10 May 2021 16:46:53 +0000 (+0300) Subject: lib-lua: dlua-dovecot - Ref event on push X-Git-Tag: 2.3.16~150 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b403bc75c87d9df2f22b5d160aed6fc6d8a7aca;p=thirdparty%2Fdovecot%2Fcore.git lib-lua: dlua-dovecot - Ref event on push Matches with unref on __gc. --- diff --git a/src/auth/db-lua.c b/src/auth/db-lua.c index 0ede7f7210..d2b48e454e 100644 --- a/src/auth/db-lua.c +++ b/src/auth/db-lua.c @@ -228,6 +228,7 @@ static int auth_request_lua_event(lua_State *L) struct event *event = event_create(authdb_event(request)); dlua_push_event(L, event); + event_unref(&event); return 1; } diff --git a/src/lib-lua/dlua-dovecot.c b/src/lib-lua/dlua-dovecot.c index 8531e6eab7..9dce09cfad 100644 --- a/src/lib-lua/dlua-dovecot.c +++ b/src/lib-lua/dlua-dovecot.c @@ -270,6 +270,7 @@ void dlua_push_event(lua_State *L, struct event *event) /* we need to attach gc to userdata to support older lua*/ struct event **ptr = lua_newuserdata(L, sizeof(struct event*)); *ptr = event; + event_ref(event); lua_createtable(L, 0, 1); lua_pushcfunction(L, dlua_event_gc); lua_setfield(L, -2, "__gc"); @@ -471,6 +472,7 @@ static int dlua_event_new(lua_State *L) dlua_get_file_line(L, 1, &file, &line); event = event_create(parent, file, line); dlua_push_event(L, event); + event_unref(&event); return 1; }