From 11f800eee022427af0324325b310494e844d0188 Mon Sep 17 00:00:00 2001 From: Peter Zhu Date: Fri, 8 Oct 2021 16:20:50 -0400 Subject: [PATCH] Fix memory leak for filters with keyword arguments --- ext/liquid_c/variable.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/ext/liquid_c/variable.c b/ext/liquid_c/variable.c index 2c5b3515..4e269176 100644 --- a/ext/liquid_c/variable.c +++ b/ext/liquid_c/variable.c @@ -72,10 +72,7 @@ static VALUE try_variable_strict_parse(VALUE uncast_args) vm_assembler_concat(code, push_keywords_code); vm_assembler_add_hash_new(code, keyword_arg_count); - // There are no external references to this temporary object, so we can eagerly free it - DATA_PTR(push_keywords_obj) = NULL; - vm_assembler_free(push_keywords_code); - rb_gc_force_recycle(push_keywords_obj); // also acts as a RB_GC_GUARD(push_keywords_obj); + RB_GC_GUARD(push_keywords_obj); } vm_assembler_add_filter(code, filter_name, arg_count); }