From dda44442d5b1a082fa798112ec70067da49ad875 Mon Sep 17 00:00:00 2001 From: Christopher Faulet Date: Mon, 12 Apr 2021 14:05:43 +0200 Subject: [PATCH] MINOR: hlua: Add function to release a lua function release_hlua_function() must be used to release a lua function. Some fixes depends on this function. --- src/hlua.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/hlua.c b/src/hlua.c index fb4e2b243..c147fc375 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -318,6 +318,16 @@ static inline struct hlua_function *new_hlua_function() return fcn; } +static inline void release_hlua_function(struct hlua_function *fcn) +{ + if (!fcn) + return; + if (fcn->name) + ha_free(&fcn->name); + LIST_DEL(&fcn->l); + ha_free(&fcn); +} + /* If the common state is set, the stack id is 0, otherwise it is the tid + 1 */ static inline int fcn_ref_to_stack_id(struct hlua_function *fcn) {