]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-lua: dlua-resume - Ensure timeout is handled correctly
authorAki Tuomi <aki.tuomi@open-xchange.com>
Tue, 4 May 2021 10:04:42 +0000 (13:04 +0300)
committerAki Tuomi <aki.tuomi@open-xchange.com>
Mon, 17 Jan 2022 11:52:09 +0000 (13:52 +0200)
src/lib-lua/dlua-resume.c

index ac46f1026e2d8cd061a4b72d8f7310a9f793fb35..8e05f5c31ce7664a2303a09fb70bea6b0b39b42f 100644 (file)
@@ -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);