diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Src/exec.c | 7 |
2 files changed, 7 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog index 36fae8a51..d173df87e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2024-07-04 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> + + * 52985: Src/exec.c: avoid adding original param to restorelist + 2024-06-24 Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> * 52968: Doc/Makefile.in: use pdfroff to create intro.pdf diff --git a/Src/exec.c b/Src/exec.c index a473938ec..097e0b368 100644 --- a/Src/exec.c +++ b/Src/exec.c @@ -4409,7 +4409,7 @@ save_params(Estate state, Wordcode pc, LinkList *restore_p, LinkList *remove_p) while (wc_code(ac = *pc) == WC_ASSIGN) { s = ecrawstr(state->prog, pc + 1, NULL); if ((pm = (Param) paramtab->getnode(paramtab, s))) { - Param tpm; + Param tpm = NULL; if (pm->env) delenv(pm); if (!(pm->node.flags & PM_SPECIAL)) { @@ -4426,7 +4426,6 @@ save_params(Estate state, Wordcode pc, LinkList *restore_p, LinkList *remove_p) tpm = (Param) zshcalloc(sizeof *tpm); tpm->node.nam = ztrdup(pm->node.nam); copyparam(tpm, pm, 0); - pm = tpm; } else if (!(pm->node.flags & PM_READONLY) && (unset(RESTRICTED) || !(pm->node.flags & PM_RESTRICTED))) { /* @@ -4437,10 +4436,10 @@ save_params(Estate state, Wordcode pc, LinkList *restore_p, LinkList *remove_p) tpm = (Param) hcalloc(sizeof *tpm); tpm->node.nam = pm->node.nam; copyparam(tpm, pm, 1); - pm = tpm; } addlinknode(*remove_p, dupstring(s)); - addlinknode(*restore_p, pm); + if (tpm) + addlinknode(*restore_p, tpm); } else addlinknode(*remove_p, dupstring(s)); |