[svn:parrot] r41242 - trunk/compilers/imcc
chromatic at svn.parrot.org
chromatic at svn.parrot.org
Sat Sep 12 21:20:14 UTC 2009
Author: chromatic
Date: Sat Sep 12 21:20:12 2009
New Revision: 41242
URL: https://trac.parrot.org/parrot/changeset/41242
Log:
[IMCC] Avoided a memory corruption error when switching namespaces to the
*current* namespace in PIR: IMCC assumed that freeing the old SymReg was always
valid. This isn't the case if it's the *same* namespace and the *same* SymReg.
See TT #992, filed by Jonathan Leto.
Modified:
trunk/compilers/imcc/parser_util.c
Modified: trunk/compilers/imcc/parser_util.c
==============================================================================
--- trunk/compilers/imcc/parser_util.c Sat Sep 12 20:23:25 2009 (r41241)
+++ trunk/compilers/imcc/parser_util.c Sat Sep 12 21:20:12 2009 (r41242)
@@ -714,13 +714,14 @@
}
if (imc_info) {
+ SymReg *ns = IMCC_INFO(interp)->cur_namespace;
IMCC_INFO(interp) = imc_info->prev;
mem_sys_free(imc_info);
imc_info = IMCC_INFO(interp);
IMCC_INFO(interp)->cur_unit = imc_info->last_unit;
- if (IMCC_INFO(interp)->cur_namespace)
- free_sym(IMCC_INFO(interp)->cur_namespace);
+ if (ns && ns != imc_info->cur_namespace)
+ free_sym(ns);
IMCC_INFO(interp)->cur_namespace = imc_info->cur_namespace;
}
More information about the parrot-commits
mailing list