From: Aki Tuomi Date: Tue, 4 May 2021 10:04:42 +0000 (+0300) Subject: lib-lua: dlua-resume - Ensure timeout is handled correctly X-Git-Tag: 2.4.0~4813 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=552ce5d5cac8cc7aaa382fba2d9db2e1aba24eb7;p=thirdparty%2Fdovecot%2Fcore.git lib-lua: dlua-resume - Ensure timeout is handled correctly --- diff --git a/src/lib-lua/dlua-resume.c b/src/lib-lua/dlua-resume.c index ac46f1026e..8e05f5c31c 100644 --- a/src/lib-lua/dlua-resume.c +++ b/src/lib-lua/dlua-resume.c @@ -112,6 +112,7 @@ static void dlua_pcall_yieldable_continue(lua_State *L) nargs = dlua_tls_get_int(L, RESUME_NARGS); to = dlua_tls_get_ptr(L, RESUME_TIMEOUT); + i_assert(to != NULL); timeout_remove(&to); dlua_tls_clear(L, RESUME_TIMEOUT); @@ -138,6 +139,9 @@ void dlua_pcall_yieldable_resume(lua_State *L, int nargs) { struct timeout *to; + to = dlua_tls_get_ptr(L, RESUME_TIMEOUT); + i_assert(to == NULL); + to = timeout_add_short(0, dlua_pcall_yieldable_continue, L); dlua_tls_set_ptr(L, RESUME_TIMEOUT, to);