1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
michal 2002-08-28 09:25:07 +00:00
parent 8790d9b76e
commit 29966e099c
2 changed files with 8 additions and 1 deletions

View file

@ -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.

4
file.c
View file

@ -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;