From 0e08b8c2e485c355acc4818c1b04a81bc7e150be Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Fri, 7 Jun 2002 14:44:21 +0000 Subject: 17299: Use reference counts in Eprogs so as to be able to free them as soon as finished with. --- Src/exec.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'Src/exec.c') diff --git a/Src/exec.c b/Src/exec.c index 4888c9fb8..04a141679 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -725,8 +725,11 @@ execode(Eprog p, int dont_change_job, int exiting) s.prog = p; s.pc = p->prog; s.strs = p->strs; + useeprog(p); /* Mark as in use */ execlist(&s, dont_change_job, exiting); + + freeeprog(p); /* Free if now unused */ } /* Execute a simplified command. This is used to execute things that @@ -3134,6 +3137,7 @@ execfuncdef(Estate state, int do_exec) while ((s = (char *) ugetnode(names))) { prog = (Eprog) zalloc(sizeof(*prog)); prog->npats = npats; + prog->nref = 1; /* allocated from permanent storage */ prog->len = len; if (state->prog->dump) { prog->flags = EF_MAP; -- cgit v1.2.3