diff options
author | michal <michal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-28 09:25:07 +0000 |
---|---|---|
committer | michal <michal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2002-08-28 09:25:07 +0000 |
commit | 29966e099c9004e1cc83b40750eb95cb13c4dbc4 (patch) | |
tree | 46f8a86ac571ca8e02efa23df97be37c81a96d7b | |
parent | 8790d9b76e103af734496fb85911daff9330cfa1 (diff) |
file.c: fix mem leak in rb_stat_init
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2756 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | file.c | 4 |
2 files changed, 8 insertions, 1 deletions
@@ -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. @@ -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; |