string.c: fix String#crypt leak introduced in r58866
* string.c (rb_str_crypt): define LARGE_CRYPT_DATA when allocating git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58876 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
daf14f713f
commit
2079b71000
2
string.c
2
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
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user