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

* regparse.c (parse_exp): fix memory leak.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
mame 2008-07-30 12:30:28 +00:00
parent 0df6cb496a
commit 2d1981b91f
2 changed files with 8 additions and 1 deletions

View file

@ -1,3 +1,7 @@
Wed Jul 30 21:30:08 2008 Yusuke Endoh <mame@tsg.ne.jp>
* regparse.c (parse_exp): fix memory leak.
Wed Jul 30 21:08:06 2008 Yusuke Endoh <mame@tsg.ne.jp> Wed Jul 30 21:08:06 2008 Yusuke Endoh <mame@tsg.ne.jp>
* regparse.c (parse_exp): fix memory leak at Regexp.new("x{1,1}"). * regparse.c (parse_exp): fix memory leak at Regexp.new("x{1,1}").

View file

@ -729,7 +729,10 @@ name_add(regex_t* reg, UChar* name, UChar* name_end, int backref, ScanEnv* env)
CHECK_NULL_RETURN_MEMERR(e); CHECK_NULL_RETURN_MEMERR(e);
e->name = strdup_with_null(reg->enc, name, name_end); e->name = strdup_with_null(reg->enc, name, name_end);
if (IS_NULL(e->name)) return ONIGERR_MEMORY; if (IS_NULL(e->name)) {
xfree(e);
return ONIGERR_MEMORY;
}
onig_st_insert_strend(t, e->name, (e->name + (name_end - name)), onig_st_insert_strend(t, e->name, (e->name + (name_end - name)),
(HashDataType )e); (HashDataType )e);