From a5b65bed01686c160c4c7278affd0eae013b6299 Mon Sep 17 00:00:00 2001 From: Oskar Eichler <62393985+OskarEichler@users.noreply.github.com> Date: Sat, 29 Aug 2026 21:40:50 +0200 Subject: [PATCH] Free native crypt buffers on failure --- ext/mri/bcrypt_ext.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ext/mri/bcrypt_ext.c b/ext/mri/bcrypt_ext.c index 3e5ac1c..0abe1d2 100644 --- a/ext/mri/bcrypt_ext.c +++ b/ext/mri/bcrypt_ext.c @@ -98,7 +98,10 @@ static VALUE bc_crypt(VALUE self, VALUE key, VALUE setting) { value = bc_crypt_nogvl((void *)&args); #endif - if(!value || !args.data) return Qnil; + if(!value || !args.data) { + free(args.data); + return Qnil; + } out = rb_str_new2(value);