about summary refs log tree commit diff
path: root/Src/Zle/zle_params.c
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2018-04-07 18:52:37 +0200
committerOliver Kiddle <okiddle@yahoo.co.uk>2018-04-07 18:52:37 +0200
commit8e6c1d8b474c6fcbe3da77a9cb2b1d31d65a6ca4 (patch)
tree967f00cdab2c095830d1a3862edfb56bf5d5a13c /Src/Zle/zle_params.c
parentd8753f47bb29d6bd5ca8d311b80fadca719982be (diff)
downloadzsh-8e6c1d8b474c6fcbe3da77a9cb2b1d31d65a6ca4.tar.gz
zsh-8e6c1d8b474c6fcbe3da77a9cb2b1d31d65a6ca4.tar.xz
zsh-8e6c1d8b474c6fcbe3da77a9cb2b1d31d65a6ca4.zip
42605: properly free the vi registers hash
Diffstat (limited to 'Src/Zle/zle_params.c')
-rw-r--r--Src/Zle/zle_params.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/Src/Zle/zle_params.c b/Src/Zle/zle_params.c
index 0a922d2d6..f3112165a 100644
--- a/Src/Zle/zle_params.c
+++ b/Src/Zle/zle_params.c
@@ -124,7 +124,7 @@ static const struct gsu_array killring_gsu =
 static const struct gsu_scalar register_gsu =
 { strgetfn, set_register, unset_register };
 static const struct gsu_hash registers_gsu =
-{ hashgetfn, set_registers, zleunsetfn };
+{ hashgetfn, set_registers, unset_registers };
 
 /* implementation is in zle_refresh.c */
 static const struct gsu_array region_highlight_gsu =
@@ -837,7 +837,17 @@ set_registers(UNUSED(Param pm), HashTable ht)
 
 	    set_register(v.pm, getstrvalue(&v));
         }
-    deleteparamtable(ht);
+    if (ht != pm->u.hash)
+	deleteparamtable(ht);
+}
+
+/**/
+static void
+unset_registers(Param pm, int exp)
+{
+    stdunsetfn(pm, exp);
+    deletehashtable(pm->u.hash);
+    pm->u.hash = NULL;
 }
 
 static void