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:
parent
674f0aa478
commit
844de6b24b
1 changed files with 4 additions and 1 deletions
5
file.c
5
file.c
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue