summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-30 12:30:28 +0000
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-07-30 12:30:28 +0000
commit2d1981b91f896a1bbc7ac11f87303fe3bc8059b5 (patch)
treea9ecfb0f29df597970fcd41ca1935086cac47667
parent0df6cb496a814b5b108c7cbf69c8237243d76ef0 (diff)
downloadruby-2d1981b91f896a1bbc7ac11f87303fe3bc8059b5.tar.gz
* regparse.c (parse_exp): fix memory leak.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog4
-rw-r--r--regparse.c5
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index b8a0061ee0..d0669419e7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* regparse.c (parse_exp): fix memory leak at Regexp.new("x{1,1}").
diff --git a/regparse.c b/regparse.c
index 0caecc11ed..3d2c57a25a 100644
--- a/regparse.c
+++ b/regparse.c
@@ -729,7 +729,10 @@ name_add(regex_t* reg, UChar* name, UChar* name_end, int backref, ScanEnv* env)
CHECK_NULL_RETURN_MEMERR(e);
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)),
(HashDataType )e);