about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Src/Modules/zutil.c13
2 files changed, 8 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index 6807b5020..ecc2213a2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2006-08-20  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* 22650: Src/Modules/zutil.c: when deleting styles, the pointer
+	to the last style can become invalid.
+
 	* 22643: Src/Zle/zle_tricky.c: completion in math context was
 	broken by searching for multibyte word characters.
 
diff --git a/Src/Modules/zutil.c b/Src/Modules/zutil.c
index e3e4c8353..1e4bf975a 100644
--- a/Src/Modules/zutil.c
+++ b/Src/Modules/zutil.c
@@ -54,7 +54,7 @@ struct stypat {
     
 /* List of styles. */
 
-static Style zstyles, zlstyles;
+static Style zstyles;
 
 /* Memory stuff. */
 
@@ -117,7 +117,7 @@ freeallstyles(void)
 	zsfree(s->name);
 	zfree(s, sizeof(*s));
     }
-    zstyles = zlstyles = NULL;
+    zstyles = NULL;
 }
 
 /* Get the style struct for a name. */
@@ -233,11 +233,8 @@ addstyle(char *name)
     s->pats = NULL;
     s->name = ztrdup(name);
 
-    if (zlstyles)
-	zlstyles->next = s;
-    else
-	zstyles = s;
-    zlstyles = s;
+    s->next = zstyles;
+    zstyles = s;
 
     return s;
 }
@@ -1748,7 +1745,7 @@ static struct builtin bintab[] = {
 int
 setup_(UNUSED(Module m))
 {
-    zstyles = zlstyles = NULL;
+    zstyles = NULL;
 
     return 0;
 }