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

fix mem leak in rb_file_s_readlink() (ruby-core:394)

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@2777 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
michal 2002-09-02 08:02:56 +00:00
parent 674f0aa478
commit 844de6b24b

5
file.c
View file

@ -1301,7 +1301,10 @@ rb_file_s_readlink(klass, path)
size *= 2;
buf = xrealloc(buf, size);
}
if (rv < 0) rb_sys_fail(RSTRING(path)->ptr);
if (rv < 0) {
free(buf);
rb_sys_fail(RSTRING(path)->ptr);
}
v = rb_tainted_str_new(buf, rv);
free(buf);