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
415ec6ac
Commit
415ec6ac
authored
Dec 03, 2013
by
Yukihiro "Matz" Matsumoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid top-level pool release at codegen_error() and fixed some memory leaks
parent
56a93a33
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
src/codegen.c
src/codegen.c
+7
-5
No files found.
src/codegen.c
View file @
415ec6ac
...
@@ -87,8 +87,6 @@ static void codegen(codegen_scope *s, node *tree, int val);
...
@@ -87,8 +87,6 @@ static void codegen(codegen_scope *s, node *tree, int val);
static
void
static
void
codegen_error
(
codegen_scope
*
s
,
const
char
*
message
)
codegen_error
(
codegen_scope
*
s
,
const
char
*
message
)
{
{
jmp_buf
jmp
;
if
(
!
s
)
return
;
if
(
!
s
)
return
;
while
(
s
->
prev
)
{
while
(
s
->
prev
)
{
codegen_scope
*
tmp
=
s
->
prev
;
codegen_scope
*
tmp
=
s
->
prev
;
...
@@ -103,9 +101,7 @@ codegen_error(codegen_scope *s, const char *message)
...
@@ -103,9 +101,7 @@ codegen_error(codegen_scope *s, const char *message)
fprintf
(
stderr
,
"codegen error: %s
\n
"
,
message
);
fprintf
(
stderr
,
"codegen error: %s
\n
"
,
message
);
}
}
#endif
#endif
memcpy
(
&
jmp
,
&
s
->
jmp
,
sizeof
(
jmp_buf
));
longjmp
(
s
->
jmp
,
1
);
mrb_pool_close
(
s
->
mpool
);
longjmp
(
jmp
,
1
);
}
}
static
void
*
static
void
*
...
@@ -2415,6 +2411,7 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv)
...
@@ -2415,6 +2411,7 @@ scope_new(mrb_state *mrb, codegen_scope *prev, node *lv)
p
->
icapa
=
1024
;
p
->
icapa
=
1024
;
p
->
iseq
=
(
mrb_code
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrb_code
)
*
p
->
icapa
);
p
->
iseq
=
(
mrb_code
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrb_code
)
*
p
->
icapa
);
p
->
irep
->
iseq
=
p
->
iseq
;
p
->
pcapa
=
32
;
p
->
pcapa
=
32
;
p
->
irep
->
pool
=
(
mrb_value
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrb_value
)
*
p
->
pcapa
);
p
->
irep
->
pool
=
(
mrb_value
*
)
mrb_malloc
(
mrb
,
sizeof
(
mrb_value
)
*
p
->
pcapa
);
...
@@ -2916,6 +2913,11 @@ mrb_generate_code(mrb_state *mrb, parser_state *p)
...
@@ -2916,6 +2913,11 @@ mrb_generate_code(mrb_state *mrb, parser_state *p)
return
proc
;
return
proc
;
}
}
else
{
else
{
if
(
scope
->
filename
==
scope
->
irep
->
filename
)
{
scope
->
irep
->
filename
=
NULL
;
}
mrb_irep_decref
(
mrb
,
scope
->
irep
);
mrb_pool_close
(
scope
->
mpool
);
return
NULL
;
return
NULL
;
}
}
}
}
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