[svn:parrot] r39485 - trunk/compilers/imcc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Tue Jun 9 23:33:26 UTC 2009
Author: chromatic
Date: Tue Jun 9 23:33:25 2009
New Revision: 39485
URL: https://trac.parrot.org/parrot/changeset/39485
Log:
[IMCC] Plugged a memory leak in PIR macros using curly braces to delineate
arguments.
Modified:
trunk/compilers/imcc/imcc.l
trunk/compilers/imcc/imclexer.c
Modified: trunk/compilers/imcc/imcc.l
==============================================================================
--- trunk/compilers/imcc/imcc.l Tue Jun 9 23:13:44 2009 (r39484)
+++ trunk/compilers/imcc/imcc.l Tue Jun 9 23:33:25 2009 (r39485)
@@ -895,8 +895,11 @@
c = yylex(&val, yyscanner, interp);
}
- if (valp)
+ if (valp) {
+ if (valp->s)
+ mem_sys_free(valp->s);
*valp = val;
+ }
else
mem_sys_free(val.s);
@@ -945,6 +948,7 @@
}
else if (c == '{') {
current = read_braced(&val, interp, macro_name, current, yyscanner);
+ mem_sys_free(val.s);
c = yylex_skip(&val, interp, " \n", yyscanner);
len = strlen(current);
}
Modified: trunk/compilers/imcc/imclexer.c
==============================================================================
--- trunk/compilers/imcc/imclexer.c Tue Jun 9 23:13:44 2009 (r39484)
+++ trunk/compilers/imcc/imclexer.c Tue Jun 9 23:33:25 2009 (r39485)
@@ -5308,8 +5308,11 @@
c = yylex(&val,yyscanner,interp);
}
- if (valp)
+ if (valp) {
+ if (valp->s)
+ mem_sys_free(valp->s);
*valp = val;
+ }
else
mem_sys_free(val.s);
@@ -5358,6 +5361,7 @@
}
else if (c == '{') {
current = read_braced(&val, interp, macro_name, current, yyscanner);
+ mem_sys_free(val.s);
c = yylex_skip(&val, interp, " \n", yyscanner);
len = strlen(current);
}
More information about the parrot-commits
mailing list