diff options
author | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2024-07-04 11:51:09 +0900 |
---|---|---|
committer | Jun-ichi Takimoto <takimoto-j@kba.biglobe.ne.jp> | 2024-07-04 11:51:09 +0900 |
commit | 2a54de167586c3b8b03019b5c52021c608bd310e (patch) | |
tree | 0e1f3e327b89cfb68e7d1487e38423f7ef15edae /Src | |
parent | da733f5df691d01caff0a01addba234aad1b6864 (diff) | |
download | zsh-2a54de167586c3b8b03019b5c52021c608bd310e.tar.gz zsh-2a54de167586c3b8b03019b5c52021c608bd310e.tar.xz zsh-2a54de167586c3b8b03019b5c52021c608bd310e.zip |
52985: avoid adding original param to restorelist
Diffstat (limited to 'Src')
-rw-r--r-- | Src/exec.c | 7 |
1 files changed, 3 insertions, 4 deletions
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)); |