=== imcc.l
==================================================================
--- imcc.l	(revision 13972)
+++ imcc.l	(local)
@@ -445,18 +445,24 @@
     }
 
 <emit,INITIAL>{DOT}{LETTER}{LETTERDIGIT}* {
-        int type = pmc_type(interp, string_from_cstring(interp, yytext+1, 0));
+        char *macro_name = str_dup(yytext+1);
+        int type = pmc_type(interp, string_from_cstring(interp, macro_name, 0));
 
         if (type > 0) {
             char *buf = malloc(16);
-        sprintf(buf, "%d", type);
-        valp->s = buf;
-        return INTC;
-    }
-    if (!expand_macro(valp, interp, yytext+1, yyscanner)) {
+            sprintf(buf, "%d", type);
+            valp->s = buf;
+            free(macro_name);
+            return INTC;
+        }
+
+        if (!expand_macro(valp, interp, macro_name, yyscanner)) {
             yyless(1);
+            free(macro_name);
             return DOT;
         }
+
+        free(macro_name);
     }
 
 <emit,INITIAL>{ID} {
