Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

PATCH: fix null check for pre-prompt functions



The following results in a null dereference:

  zmodload -F zsh/sched -CRAP

The cause being that the schedd cleanup_ function is called even though
the initialisation failed before it got as far as initialising the
linked list of pre-prompt functions. This adds a check.

Oliver

diff --git a/Src/utils.c b/Src/utils.c
index a74c8bd2c..ed3690172 100644
--- a/Src/utils.c
+++ b/Src/utils.c
@@ -1378,6 +1378,9 @@ delprepromptfn(voidvoidfnptr_t func)
 {
     LinkNode ln;
 
+    if (!prepromptfns)
+	return;
+
     for (ln = firstnode(prepromptfns); ln; ln = nextnode(ln)) {
 	Prepromptfn ppdat = (Prepromptfn)getdata(ln);
 	if (ppdat->func == func) {




Messages sorted by: Reverse Date, Date, Thread, Author