From 75dc429f3ec6c971cbcc109669bf604c923e3834 Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 10 Apr 2016 07:30:42 +0000 Subject: 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 --- win32/file.c | 8 ++++---- 1 file 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); } -- cgit v1.2.3