1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

never-NULL pointer check

* dir.c (ruby_glob0): no need to check never-NULL pointer.
  reported by Denis Denisov <denji0k AT gmail.com>.
* win32/file.c (rb_file_expand_path_internal): ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49024 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-12-26 05:51:36 +00:00
parent ea9ff28f80
commit 859f3d14ed
3 changed files with 8 additions and 3 deletions

View file

@ -1,4 +1,9 @@
Fri Dec 26 14:48:10 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
Fri Dec 26 14:51:34 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dir.c (ruby_glob0): no need to check never-NULL pointer.
reported by Denis Denisov <denji0k AT gmail.com>.
* win32/file.c (rb_file_expand_path_internal): ditto.
* win32/file.c (code_page_i): handle realloc failure.
reported by Denis Denisov <denji0k AT gmail.com>.

2
dir.c
View file

@ -1690,7 +1690,7 @@ ruby_glob0(const char *path, int flags, ruby_glob_func *func, VALUE arg, rb_enco
root = rb_enc_path_skip_prefix(root, root + strlen(root), enc);
#endif
if (root && *root == '/') root++;
if (*root == '/') root++;
n = root - start;
buf = GLOB_ALLOC_N(char, n + 1);

View file

@ -626,7 +626,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
if (whome)
xfree(whome);
if (wfullpath && wfullpath != wfullpath_buffer)
if (wfullpath != wfullpath_buffer)
xfree(wfullpath);
if (fullpath)