macro: Fix memory leak with keyword "enclose" arguments.
[pspp] / src / language / lexer / macro.c
index 814740bfac4e29bea9dc1365864c725034acbad0..62d060aad2ce21bc6320c0f05960f46051993cd4 100644 (file)
@@ -707,7 +707,8 @@ mc_enclose (struct macro_call *mc, const struct macro_token *mt,
       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;
     }