summary refs log tree commit diff
path: root/Src/builtin.c
diff options
context:
space:
mode:
Diffstat (limited to 'Src/builtin.c')
-rw-r--r--Src/builtin.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Src/builtin.c b/Src/builtin.c
index a2a3ad748..4a10c7dd1 100644
--- a/Src/builtin.c
+++ b/Src/builtin.c
@@ -2759,7 +2759,7 @@ bin_functions(char *name, char **argv, Options ops, int func)
 		tokenize(*argv);
 		if ((pprog = patcompile(*argv, PAT_STATIC, 0))) {
 		    queue_signals();
-		    for (p = mathfuncs, q = NULL; p; q = p, p = p->next) {
+		    for (p = mathfuncs, q = NULL; p; q = p) {
 			MathFunc next;
 			do {
 			    next = NULL;
@@ -2774,6 +2774,8 @@ bin_functions(char *name, char **argv, Options ops, int func)
 			    }
 			    /* if we deleted one, retry with the new p */
 			} while (next);
+			if (p)
+			    p = p->next;
 		    }
 		    unqueue_signals();
 		} else {