summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--file.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 901e65c675..95a970dd6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+Wed Aug 28 18:19:55 2002 Michal Rokos <michal@ruby-lang.org>
+
+ * file.c: fix memory leak in rb_stat_init.
+
Wed Aug 28 17:45:03 2002 Nobuyoshi Nakada <nobu.nokada@softhome.net>
* win32/win32.c (kill): negate pid under Win9x.
@@ -20,7 +24,6 @@ Wed Aug 28 15:00:29 2002 Yukihiro Matsumoto <matz@ruby-lang.org>
* string.c (rb_str_intern): ditto.
->>>>>>> 1.1095
Wed Aug 28 11:37:35 2002 NAKAMURA Usaku <usa@ruby-lang.org>
* win32/win32.h: define SIGINT and SIGKILL if not defined.
diff --git a/file.c b/file.c
index 20f0d791a8..719bb27557 100644
--- a/file.c
+++ b/file.c
@@ -2009,6 +2009,10 @@ rb_stat_init(obj, fname)
if (stat(RSTRING(fname)->ptr, &st) == -1) {
rb_sys_fail(RSTRING(fname)->ptr);
}
+ if (DATA_PTR(obj)) {
+ free(DATA_PTR(obj));
+ DATA_PTR(obj) = NULL;
+ }
nst = ALLOC(struct stat);
*nst = st;
DATA_PTR(obj) = nst;