mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* win32/win32.c (check_if_dir): fix memory leak.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35148 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
2434ad11e4
commit
35259b72f2
2 changed files with 18 additions and 20 deletions
|
@ -1,3 +1,7 @@
|
||||||
|
Tue Mar 27 17:08:08 2012 Kazuhiro NISHIYAMA <zn@mbf.nifty.com>
|
||||||
|
|
||||||
|
* win32/win32.c (check_if_dir): fix memory leak.
|
||||||
|
|
||||||
Tue Mar 27 13:13:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
Tue Mar 27 13:13:51 2012 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||||
|
|
||||||
* string.c (str_new_empty): should copy also the encoding as an
|
* string.c (str_new_empty): should copy also the encoding as an
|
||||||
|
|
|
@ -5184,26 +5184,6 @@ rb_w32_uopen(const char *file, int oflag, ...)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* License: Ruby's */
|
|
||||||
static int
|
|
||||||
check_if_dir(const char *file)
|
|
||||||
{
|
|
||||||
DWORD attr;
|
|
||||||
WCHAR *wfile;
|
|
||||||
|
|
||||||
if (!(wfile = filecp_to_wstr(file, NULL)))
|
|
||||||
return FALSE;
|
|
||||||
attr = GetFileAttributesW(wfile);
|
|
||||||
if (attr == (DWORD)-1L ||
|
|
||||||
!(attr & FILE_ATTRIBUTE_DIRECTORY) ||
|
|
||||||
check_valid_dir(wfile)) {
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
free(wfile);
|
|
||||||
errno = EISDIR;
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* License: Ruby's */
|
/* License: Ruby's */
|
||||||
static int
|
static int
|
||||||
check_if_wdir(const WCHAR *wfile)
|
check_if_wdir(const WCHAR *wfile)
|
||||||
|
@ -5218,6 +5198,20 @@ check_if_wdir(const WCHAR *wfile)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* License: Ruby's */
|
||||||
|
static int
|
||||||
|
check_if_dir(const char *file)
|
||||||
|
{
|
||||||
|
WCHAR *wfile;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
if (!(wfile = filecp_to_wstr(file, NULL)))
|
||||||
|
return FALSE;
|
||||||
|
ret = check_if_wdir(wfile);
|
||||||
|
free(wfile);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* License: Ruby's */
|
/* License: Ruby's */
|
||||||
int
|
int
|
||||||
rb_w32_open(const char *file, int oflag, ...)
|
rb_w32_open(const char *file, int oflag, ...)
|
||||||
|
|
Loading…
Add table
Reference in a new issue