]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
CLEANUP: hlua: use hlua_ref() instead of luaL_ref()
authorAurelien DARRAGON <adarragon@haproxy.com>
Mon, 20 Mar 2023 16:42:08 +0000 (17:42 +0100)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 5 Apr 2023 06:58:17 +0000 (08:58 +0200)
Using hlua_ref() everywhere temporary lua objects are involved.
Those references are expected to be cleared using hlua_unref()
when they are no longer used.

src/hlua.c

index 66018d150c51a856106730c1c9bef68854dc5fdd..826109930bf9bd6d2b5bd09ba76facb93160d17c 100644 (file)
@@ -10577,7 +10577,7 @@ static int hlua_filter_init_per_thread(struct proxy *px, struct flt_conf *fconf)
                lua_insert(L, -2);
                lua_settable(L, -4);
        }
-       flt_ref = luaL_ref(L, LUA_REGISTRYINDEX);
+       flt_ref = hlua_ref(L);
 
        /* Remove the original lua filter class from the stack */
        lua_pop(L, 1);
@@ -10789,7 +10789,7 @@ static int hlua_filter_new(struct stream *s, struct filter *filter)
 
                /* Save a ref on the filter ctx */
                lua_pushvalue(s->hlua->T, 1);
-               flt_ctx->ref = luaL_ref(s->hlua->T, LUA_REGISTRYINDEX);
+               flt_ctx->ref = hlua_ref(s->hlua->T);
                filter->ctx = flt_ctx;
                break;
        case HLUA_E_ERRMSG: