The memory for the argument was being allocated two places, which caused
the first-allocated block to be leaked.
Found by Address Sanitizer.
mc->n_tokens++;
struct macro_tokens **argp = &mc->args[p - mc->macro->params];
mc->n_tokens++;
struct macro_tokens **argp = &mc->args[p - mc->macro->params];
- *argp = xzalloc (sizeof **argp);
+ if (!*argp)
+ *argp = xzalloc (sizeof **argp);
mc->state = MC_ARG;
return 0;
}
mc->state = MC_ARG;
return 0;
}