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/trunk@16518 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-05-22 00:57:47 +00:00
parent 1ef64a6624
commit 9d27c792c2
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

@ -2848,6 +2848,7 @@ flatten(VALUE ary, int level, int *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);