]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
daemon/bindings: return top to previous after timer
authorMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 13 Jun 2015 17:23:54 +0000 (19:23 +0200)
committerMarek Vavruša <marek.vavrusa@nic.cz>
Sat, 13 Jun 2015 17:23:54 +0000 (19:23 +0200)
daemon/bindings.c

index cb20310dbe9b4dbd878abe2c6d5d7b5930da279b..9bf8338906dd43c85300275ac912878bcced834c 100644 (file)
@@ -449,6 +449,7 @@ static void event_callback(uv_timer_t *timer)
        lua_State *L = worker->engine->L;
 
        /* Retrieve callback and execute */
+       int top = lua_gettop(L);
        lua_rawgeti(L, LUA_REGISTRYINDEX, (intptr_t) timer->data);
        lua_rawgeti(L, -1, 1);
        lua_pushinteger(L, (intptr_t) timer->data);
@@ -457,7 +458,7 @@ static void event_callback(uv_timer_t *timer)
                fprintf(stderr, "error: %s\n", lua_tostring(L, -1));
        }
        /* Clear the stack, there may be event a/o enything returned */
-       lua_settop(L, 0);
+       lua_settop(L, top);
        /* Free callback if not recurrent or an error */
        if (ret != 0 || uv_timer_get_repeat(timer) == 0) {
                uv_close((uv_handle_t *)timer, (uv_close_cb) event_free);