From 844de6b24b8152dc2f11ef3636e1dae91978a6f3 Mon Sep 17 00:00:00 2001 From: michal Date: Mon, 2 Sep 2002 08:02:56 +0000 Subject: 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 --- file.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'file.c') diff --git a/file.c b/file.c index fe13a9ee59..3e53f70982 100644 --- a/file.c +++ b/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); -- cgit v1.2.3