summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-15 02:48:40 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-12-15 02:48:40 +0000
commitc476b6e05c1cae6de5d24b823e676566ae27de6c (patch)
treea3e4b491a359210927552292d3076992dc516a7d
parent009f78761d729b18ac34749136f1474d89d54a69 (diff)
* parse.y (dispose_string): dispose String object.
* parse.y (heredoc_restore, here_document): fix memory leak. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3147 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog16
-rw-r--r--parse.y12
2 files changed, 21 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index afc9094717..e724363036 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,16 @@
+Sun Dec 15 11:43:26 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
+
+ * parse.y (dispose_string): dispose String object.
+
+ * parse.y (heredoc_restore, here_document): fix memory leak.
+
Sat Dec 14 14:25:00 2002 Takaaki Uematsu <mail@uema2.cjb.net>
- * wince/sys : add stat.c, stat.h, timeb.c, timeb.h,
- types.h, utime.c, utime.h
- * wince/dll.mak : object file name changed.
- * wince/io.c : add empty dup2().
- * wince/io.h : add dup2 definition.
+ * wince/sys : add stat.c, stat.h, timeb.c, timeb.h,
+ types.h, utime.c, utime.h
+ * wince/dll.mak : object file name changed.
+ * wince/io.c : add empty dup2().
+ * wince/io.h : add dup2 definition.
Sat Dec 14 01:51:29 2002 WATANABE Hirofumi <eban@ruby-lang.org>
diff --git a/parse.y b/parse.y
index 3b37a53e68..4ffee17ae1 100644
--- a/parse.y
+++ b/parse.y
@@ -2829,6 +2829,14 @@ enum string_type {
str_dsym = (STR_FUNC_SYMBOL|STR_FUNC_EXPAND),
};
+static void
+dispose_string(str)
+ VALUE str;
+{
+ free(RSTRING(str)->ptr);
+ rb_gc_force_recycle(str);
+}
+
static int
tokadd_string(func, term, paren)
int func, term, paren;
@@ -3044,7 +3052,7 @@ heredoc_restore(here)
lex_p = lex_pbeg + here->nd_nth;
heredoc_end = ruby_sourceline;
ruby_sourceline = nd_line(here);
- rb_gc_force_recycle(here->nd_lit);
+ dispose_string(here->nd_lit);
rb_gc_force_recycle((VALUE)here);
}
@@ -3099,7 +3107,7 @@ here_document(here)
str = rb_str_new(RSTRING(line)->ptr, RSTRING(line)->len);
lex_p = lex_pend;
if (nextc() == -1) {
- if (str) rb_gc_force_recycle(str);
+ if (str) dispose_string(str);
goto error;
}
} while (!whole_match_p(eos, len, indent));