]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: hlua: Add function to release a lua function
authorChristopher Faulet <cfaulet@haproxy.com>
Mon, 12 Apr 2021 12:05:43 +0000 (14:05 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Mon, 12 Apr 2021 13:46:53 +0000 (15:46 +0200)
release_hlua_function() must be used to release a lua function. Some fixes
depends on this function.

src/hlua.c

index fb4e2b243cf221a45f9d0c4cb4baa5b8cc57fb0d..c147fc3752657dbfc6959235f554ac5523e506fd 100644 (file)
@@ -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)
 {