ruby-changes:42452
From: nobu <ko1@a...>
Date: Sun, 10 Apr 2016 15:34:09 +0900 (JST)
Subject: [ruby-changes:42452] nobu:r54526 (trunk): win32/file.c: fix free
nobu 2016-04-10 16:30:42 +0900 (Sun, 10 Apr 2016) New Revision: 54526 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54526 Log: 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. Modified files: trunk/win32/file.c Index: win32/file.c =================================================================== --- win32/file.c (revision 54525) +++ win32/file.c (revision 54526) @@ -375,13 +375,13 @@ rb_file_expand_path_internal(VALUE fname https://github.com/ruby/ruby/blob/trunk/win32/file.c#L375 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 https://github.com/ruby/ruby/blob/trunk/win32/file.c#L423 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 https://github.com/ruby/ruby/blob/trunk/win32/file.c#L440 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); } -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/