aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-10 07:30:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-04-10 07:30:42 +0000
commit75dc429f3ec6c971cbcc109669bf604c923e3834 (patch)
treec1e5ac8d7714346b95be232acf85427138192354
parent997df3ad0149fd69c3574660af26170d7464a6f3 (diff)
downloadruby-75dc429f3ec6c971cbcc109669bf604c923e3834.tar.gz
win32/file.c: fix free
* win32/file.c (rb_file_expand_path_internal): should free wpath, but not xfree, corresponding to rb_w32_mbstr_to_wstr which allocates by malloc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54526 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--win32/file.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/win32/file.c b/win32/file.c
index 3b18a36348..d1b9bf0d21 100644
--- a/win32/file.c
+++ b/win32/file.c
@@ -375,13 +375,13 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
whome = home_dir();
if (whome == NULL) {
- xfree(wpath);
+ free(wpath);
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `~'");
}
whome_len = wcslen(whome);
if (PathIsRelativeW(whome) && !(whome_len >= 2 && IS_DIR_UNC_P(whome))) {
- xfree(wpath);
+ free(wpath);
xfree(whome);
rb_raise(rb_eArgError, "non-absolute home");
}
@@ -423,7 +423,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
cp, path_cp, path_encoding);
if (wpath)
- xfree(wpath);
+ free(wpath);
rb_exc_raise(rb_exc_new_str(rb_eArgError, result));
}
@@ -440,7 +440,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
const long dir_len = RSTRING_LEN(dir);
#if SIZEOF_INT < SIZEOF_LONG
if ((long)(int)dir_len != dir_len) {
- if (wpath) xfree(wpath);
+ if (wpath) free(wpath);
rb_raise(rb_eRangeError, "base directory (%ld bytes) is too long",
dir_len);
}