summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-08-15 09:04:32 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-08-15 09:04:32 +0000
commit82178a552907e413a09f5dfe646fb3e876f4011c (patch)
tree7c3144aaa982b4f882818211b22f7a1fd4b27ba8
parent740a664bc8615656bea6e1181bf5c65ee56d8a60 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog8
-rw-r--r--env.h4
-rw-r--r--eval.c6
-rw-r--r--lib/net/ftp.rb1
4 files changed, 17 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c3c9627b1cd..f74ef95126f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Aug 15 17:30:59 2000 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * eval.c (frame_dup): should set flag FRAME_MALLOC after
+ argv allocation.
+
+ * eval.c (blk_free): should not free argv if GC was called before
+ frame_dup.
+
Tue Aug 15 16:08:40 2000 WATANABE Hirofumi <eban@os.rim.or.jp>
* configure.in: add ac_cv_func_times=yes for mingw32.
diff --git a/env.h b/env.h
index 586d66c32bc..3669baa33e6 100644
--- a/env.h
+++ b/env.h
@@ -25,10 +25,14 @@ extern struct FRAME {
char *file;
int line;
int iter;
+ int flags;
} *ruby_frame;
void rb_gc_mark_frame _((struct FRAME *));
+#define FRAME_ALLOCA 0
+#define FRAME_MALLOC 1
+
extern struct SCOPE {
struct RBasic super;
ID *local_tbl;
diff --git a/eval.c b/eval.c
index 7ff72995c2c..42ca67efc7d 100644
--- a/eval.c
+++ b/eval.c
@@ -505,6 +505,7 @@ static struct SCOPE *top_scope;
_frame.cbase = ruby_frame->cbase; \
_frame.argc = 0; \
_frame.argv = 0; \
+ _frame.flags = FRAME_ALLOCA; \
ruby_frame = &_frame; \
#define POP_FRAME() \
@@ -5682,7 +5683,7 @@ blk_free(data)
frame = data->frame.prev;
while (frame) {
- if (frame->argc > 0)
+ if (frame->argc > 0 && (frame->flags & FRAME_MALLOC))
free(frame->argv);
tmp = frame;
frame = frame->prev;
@@ -5728,6 +5729,7 @@ frame_dup(frame)
argv = ALLOC_N(VALUE, frame->argc);
MEMCPY(argv, frame->argv, VALUE, frame->argc);
frame->argv = argv;
+ frame->flags = FRAME_MALLOC;
}
frame->tmp = 0; /* should not preserve tmp */
if (!frame->prev) break;
@@ -7781,7 +7783,7 @@ rb_thread_status(thread)
rb_thread_t th = rb_thread_check(thread);
if (rb_thread_dead(th)) {
- if (NIL_P(th->errinfo) && (th->flags & THREAD_RAISED))
+ if (!NIL_P(th->errinfo) && (th->flags & THREAD_RAISED))
return Qnil;
return Qfalse;
}
diff --git a/lib/net/ftp.rb b/lib/net/ftp.rb
index a40b3532b11..a63acec1d8a 100644
--- a/lib/net/ftp.rb
+++ b/lib/net/ftp.rb
@@ -216,6 +216,7 @@ module Net
raise FTPReplyError, resp
end
conn = sock.accept
+ sock.close
end
return conn
end