1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* array.c (flatten): free memo hash table before raising exception.

[ruby-dev:34789]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-05-22 00:57:53 +00:00
parent b8424eaf02
commit eb995e1120
2 changed files with 6 additions and 0 deletions

View file

@ -1,3 +1,8 @@
Thu May 22 08:28:49 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (flatten): free memo hash table before raising exception.
[ruby-dev:34789]
Thu May 22 06:30:10 2008 Hidetoshi NAGAI <nagai@ai.kyutech.ac.jp>
* array.c (flatten): fix memory leak.

View file

@ -3124,6 +3124,7 @@ flatten(ary, level, modified)
*modified = 1;
id = (st_data_t)tmp;
if (st_lookup(memo, id, 0)) {
st_free_table(memo);
rb_raise(rb_eArgError, "tried to flatten recursive array");
}
st_insert(memo, id, (st_data_t)Qtrue);