From fc01fceca430dd8d3ecb9e8d69c4501da8130503 Mon Sep 17 00:00:00 2001 From: Ulysse Buonomo Date: Fri, 14 Oct 2022 13:40:29 +0200 Subject: [PATCH] fix leak 2 --- ext/geos_c_impl/ruby_more.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ext/geos_c_impl/ruby_more.c b/ext/geos_c_impl/ruby_more.c index 9f456b75..4de129f3 100644 --- a/ext/geos_c_impl/ruby_more.c +++ b/ext/geos_c_impl/ruby_more.c @@ -33,6 +33,7 @@ rb_protect_funcall(VALUE recv, ID mid, int* state, int n, ...) { struct funcall_args args; VALUE* argv; + VALUE result; va_list ar; if (n > 0) { @@ -52,7 +53,12 @@ rb_protect_funcall(VALUE recv, ID mid, int* state, int n, ...) args.argc = n; args.argv = argv; - return rb_protect(inner_funcall, (VALUE)&args, state); + result = rb_protect(inner_funcall, (VALUE)&args, state); + + if (n > 0) + RB_FREE(argv); + + return result; } RGEO_END_C