about summary refs log tree commit diff
diff options
context:
space:
mode:
authorBart Schaefer <schaefer@zsh.org>2024-08-05 15:49:15 -0700
committerBart Schaefer <schaefer@zsh.org>2024-08-05 15:49:15 -0700
commit65da4674410abac23e41f89f29f6613d74858854 (patch)
treecf133101fa722bee67ff98e7fc179d3a970ae3a9
parent4616ea398a5c1b04299dff9d25a8bc264c685540 (diff)
downloadzsh-65da4674410abac23e41f89f29f6613d74858854.tar.gz
zsh-65da4674410abac23e41f89f29f6613d74858854.tar.xz
zsh-65da4674410abac23e41f89f29f6613d74858854.zip
53023: fix memory leak of unset private parameter
-rw-r--r--ChangeLog4
-rw-r--r--Src/params.c2
2 files changed, 5 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 41204dfd6..56f6d0f35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2024-08-05  Bart Schaefer  <schaefer@zsh.org>
+
+	* 53023: Src/params.c: fix memory leak of unset private parameter
+
 2024-08-04  Bart Schaefer  <schaefer@zsh.org>
 
 	* Philippe Altherr: 53005: Src/exec.c: off-by-one error when
diff --git a/Src/params.c b/Src/params.c
index f65aa1e80..83bdb785d 100644
--- a/Src/params.c
+++ b/Src/params.c
@@ -3790,7 +3790,7 @@ unsetparam_pm(Param pm, int altflag, int exp)
 	altremove = NULL;
 
     pm->node.flags &= ~PM_DECLARED;	/* like ksh, not like bash */
-    if (!(pm->node.flags & PM_UNSET))
+    if (!(pm->node.flags & PM_UNSET) || (pm->node.flags & PM_REMOVABLE))
 	pm->gsu.s->unsetfn(pm, exp);
     if (pm->env)
 	delenv(pm);