Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mruby
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
mruby
Commits
5e7ced07
Unverified
Commit
5e7ced07
authored
Jun 19, 2018
by
Yukihiro "Matz" Matsumoto
Committed by
GitHub
Jun 19, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4047 from kou/stop-to-use-freed-value
Stop to use freed value
parents
47413d05
33c8c8f8
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
mrbgems/mruby-io/src/file.c
mrbgems/mruby-io/src/file.c
+7
-4
No files found.
mrbgems/mruby-io/src/file.c
View file @
5e7ced07
...
...
@@ -114,11 +114,13 @@ mrb_file_s_unlink(mrb_state *mrb, mrb_value obj)
mrb_get_args
(
mrb
,
"*"
,
&
argv
,
&
argc
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
const
char
*
utf8_path
;
pathv
=
mrb_convert_type
(
mrb
,
argv
[
i
],
MRB_TT_STRING
,
"String"
,
"to_str"
);
path
=
mrb_locale_from_utf8
(
mrb_string_value_cstr
(
mrb
,
&
pathv
),
-
1
);
utf8_path
=
mrb_string_value_cstr
(
mrb
,
&
pathv
);
path
=
mrb_locale_from_utf8
(
utf8_path
,
-
1
);
if
(
UNLINK
(
path
)
<
0
)
{
mrb_locale_free
(
path
);
mrb_sys_fail
(
mrb
,
path
);
mrb_sys_fail
(
mrb
,
utf8_
path
);
}
mrb_locale_free
(
path
);
}
...
...
@@ -415,10 +417,11 @@ mrb_file_s_chmod(mrb_state *mrb, mrb_value klass) {
mrb_get_args
(
mrb
,
"i*"
,
&
mode
,
&
filenames
,
&
argc
);
for
(
i
=
0
;
i
<
argc
;
i
++
)
{
char
*
path
=
mrb_locale_from_utf8
(
mrb_str_to_cstr
(
mrb
,
filenames
[
i
]),
-
1
);
const
char
*
utf8_path
=
mrb_str_to_cstr
(
mrb
,
filenames
[
i
]);
char
*
path
=
mrb_locale_from_utf8
(
utf8_path
,
-
1
);
if
(
CHMOD
(
path
,
mode
)
==
-
1
)
{
mrb_locale_free
(
path
);
mrb_sys_fail
(
mrb
,
path
);
mrb_sys_fail
(
mrb
,
utf8_
path
);
}
mrb_locale_free
(
path
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment