summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1998-05-02 02:41:57 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1998-05-02 02:41:57 +0000
commitac33bf2bc3df311c4d87bec5e6617653779e7342 (patch)
treec0898023fc680876b66123cd0ac27d25f199455b
parentc988b02f15138c64b03c386eaabeb55809074bb4 (diff)
fix yet another malloc problem.
malloc(2) states quite clear that "malloc() allocates uninitialized space" just one malloc'ed memory is cleared by this fix. do a 'sort -u /dev/null' w/ /etc/malloc.conf -> J> to reproduce.
-rw-r--r--usr.bin/sort/append.c6
-rw-r--r--usr.bin/sort/fsort.c5
2 files changed, 6 insertions, 5 deletions
diff --git a/usr.bin/sort/append.c b/usr.bin/sort/append.c
index 055d3e4111d..9542fb5e86b 100644
--- a/usr.bin/sort/append.c
+++ b/usr.bin/sort/append.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: append.c,v 1.3 1997/06/30 05:36:15 millert Exp $ */
+/* $OpenBSD: append.c,v 1.4 1998/05/02 02:41:55 mickey Exp $ */
/*-
* Copyright (c) 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)append.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: append.c,v 1.3 1997/06/30 05:36:15 millert Exp $";
+static char rcsid[] = "$OpenBSD: append.c,v 1.4 1998/05/02 02:41:55 mickey Exp $";
#endif
#endif /* not lint */
@@ -126,7 +126,7 @@ append(keylist, nelem, depth, fp, put, ftbl)
}
}
if (!UNIQUE)
- OUTPUT;
+ OUTPUT
} else if (UNIQUE) {
ppos = keylist;
prec = (RECHEADER *) (*ppos - depth);
diff --git a/usr.bin/sort/fsort.c b/usr.bin/sort/fsort.c
index fb8fe6e5788..6abd6e0b74a 100644
--- a/usr.bin/sort/fsort.c
+++ b/usr.bin/sort/fsort.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fsort.c,v 1.5 1997/06/30 05:36:16 millert Exp $ */
+/* $OpenBSD: fsort.c,v 1.6 1998/05/02 02:41:56 mickey Exp $ */
/*-
* Copyright (c) 1993
@@ -40,7 +40,7 @@
#if 0
static char sccsid[] = "@(#)fsort.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: fsort.c,v 1.5 1997/06/30 05:36:16 millert Exp $";
+static char rcsid[] = "$OpenBSD: fsort.c,v 1.6 1998/05/02 02:41:56 mickey Exp $";
#endif
#endif /* not lint */
@@ -95,6 +95,7 @@ fsort(binno, depth, infiles, nfiles, outfp, ftbl)
if (!buffer) {
buffer = malloc(BUFSIZE + 1);
keylist = malloc(MAXNUM * sizeof(u_char *));
+ memset(keylist, 0, MAXNUM * sizeof(u_char *));
if (!SINGL_FLD)
linebuf = malloc(MAXLLEN);
}