summaryrefslogtreecommitdiffstats
path: root/usr.bin/diff/diffreg.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>2003-07-27 18:58:26 +0000
committermillert <millert@openbsd.org>2003-07-27 18:58:26 +0000
commit058e94f45f0f7637692a204520d8e0e76b715a20 (patch)
treebc9ffcb6a85895457a3b69e2686a2b21b49afbb6 /usr.bin/diff/diffreg.c
parentCorrect computation of argsize when setting diffargs. (diff)
downloadwireguard-openbsd-058e94f45f0f7637692a204520d8e0e76b715a20.tar.xz
wireguard-openbsd-058e94f45f0f7637692a204520d8e0e76b715a20.zip
We need to initialize clen to 0 each time through diffreg() for
when diffreg() is called multiple times (i.e. in directory mode). Fixes a hang I saw doing "diff -r" of two large directory trees.
Diffstat (limited to 'usr.bin/diff/diffreg.c')
-rw-r--r--usr.bin/diff/diffreg.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
index 85f4e45fcdd..33a2cd31581 100644
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: diffreg.c,v 1.43 2003/07/27 07:39:52 otto Exp $ */
+/* $OpenBSD: diffreg.c,v 1.44 2003/07/27 18:58:26 millert Exp $ */
/*
* Copyright (C) Caldera International Inc. 2001-2002.
@@ -65,7 +65,7 @@
*/
#ifndef lint
-static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.43 2003/07/27 07:39:52 otto Exp $";
+static const char rcsid[] = "$OpenBSD: diffreg.c,v 1.44 2003/07/27 18:58:26 millert Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -418,6 +418,7 @@ notsame:
class = erealloc(class, (slen[0] + 2) * sizeof(int));
klist = emalloc((slen[0] + 2) * sizeof(int));
+ clen = 0;
clistlen = 100;
clist = emalloc(clistlen * sizeof(cand));
i = stone(class, slen[0], member, klist);