diff --git a/string.c b/string.c index bd4a481203..8de556718e 100644 --- a/string.c +++ b/string.c @@ -8727,7 +8727,7 @@ rb_str_crypt(VALUE str, VALUE salt) # if defined SIZEOF_CRYPT_DATA && SIZEOF_CRYPT_DATA <= 256 struct crypt_data cdata, *const data = &cdata; # else -# undef LARGE_CRYPT_DATA +# define LARGE_CRYPT_DATA struct crypt_data *data = ALLOC(struct crypt_data); # endif #else diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 232d92b2a3..e28dca5012 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -546,6 +546,10 @@ CODE assert_raise(ArgumentError) {S("mypassword").crypt(S("aa".encode(enc)))} assert_raise(ArgumentError) {S("mypassword".encode(enc)).crypt(S("aa"))} end + + @cls == String and assert_no_memory_leak([], 's = ""', <<~'end;') # do + 1000.times { s.crypt(-"..").clear } + end; end def test_delete