summaryrefslogtreecommitdiffhomepage
path: root/src/parse.y
diff options
context:
space:
mode:
authorYukihiro Matsumoto <[email protected]>2012-09-03 08:34:31 +0900
committerYukihiro Matsumoto <[email protected]>2012-09-03 08:34:31 +0900
commit4f7a1a167db8a3373b356540eaee21f9cf93e7f2 (patch)
treeecb3153837939d66d675f08cb67babdd2c83c392 /src/parse.y
parent5340126443609265d63159e4c391049cb722f828 (diff)
downloadmruby-4f7a1a167db8a3373b356540eaee21f9cf93e7f2.tar.gz
mruby-4f7a1a167db8a3373b356540eaee21f9cf93e7f2.zip
remove memleaks using linked allocator
Diffstat (limited to 'src/parse.y')
-rw-r--r--src/parse.y4
1 files changed, 1 insertions, 3 deletions
diff --git a/src/parse.y b/src/parse.y
index 5d1acf012..d7d0ce73e 100644
--- a/src/parse.y
+++ b/src/parse.y
@@ -4789,7 +4789,6 @@ void
mrbc_context_free(mrb_state *mrb, mrbc_context *cxt)
{
mrb_free(mrb, cxt->syms);
- mrb_free(mrb, cxt->filename);
mrb_free(mrb, cxt);
}
@@ -4798,10 +4797,9 @@ mrbc_filename(mrb_state *mrb, mrbc_context *c, const char *s)
{
if (s) {
int len = strlen(s);
- char *p = (char *)mrb_malloc(mrb, len + 1);
+ char *p = (char *)mrb_alloca(mrb, len + 1);
memcpy(p, s, len + 1);
- if (c->filename) mrb_free(mrb, c->filename);
c->filename = p;
c->lineno = 1;
}