Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-6]: src/lib/libc/db/hash Pullup rev 1.9 (requested by bouyer in...
details: https://anonhg.NetBSD.org/src/rev/79e290eafc47
branches: netbsd-1-6
changeset: 531239:79e290eafc47
user: jmc <jmc%NetBSD.org@localhost>
date: Tue Apr 06 05:43:18 2004 +0000
description:
Pullup rev 1.9 (requested by bouyer in ticket #1651)
lib/libc/db/hash/* writes memory garbage to db file.
Fixed by changing malloc's to calloc's where needed. PR#5996
diffstat:
lib/libc/db/hash/hash_buf.c | 14 ++++----------
1 files changed, 4 insertions(+), 10 deletions(-)
diffs (39 lines):
diff -r ad9e117989ac -r 79e290eafc47 lib/libc/db/hash/hash_buf.c
--- a/lib/libc/db/hash/hash_buf.c Tue Apr 06 05:40:45 2004 +0000
+++ b/lib/libc/db/hash/hash_buf.c Tue Apr 06 05:43:18 2004 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: hash_buf.c,v 1.8 1998/12/09 12:42:49 christos Exp $ */
+/* $NetBSD: hash_buf.c,v 1.8.14.1 2004/04/06 05:43:18 jmc Exp $ */
/*-
* Copyright (c) 1990, 1993, 1994
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)hash_buf.c 8.5 (Berkeley) 7/15/94";
#else
-__RCSID("$NetBSD: hash_buf.c,v 1.8 1998/12/09 12:42:49 christos Exp $");
+__RCSID("$NetBSD: hash_buf.c,v 1.8.14.1 2004/04/06 05:43:18 jmc Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -184,18 +184,12 @@
*/
if (hashp->nbufs || (bp->flags & BUF_PIN)) {
/* Allocate a new one */
- if ((bp = (BUFHEAD *)malloc(sizeof(BUFHEAD))) == NULL)
+ if ((bp = (BUFHEAD *)calloc(1, sizeof(BUFHEAD))) == NULL)
return (NULL);
-#ifdef PURIFY
- memset(bp, 0xff, sizeof(BUFHEAD));
-#endif
- if ((bp->page = (char *)malloc((size_t)hashp->BSIZE)) == NULL) {
+ if ((bp->page = calloc(1, (size_t)hashp->BSIZE)) == NULL) {
free(bp);
return (NULL);
}
-#ifdef PURIFY
- memset(bp->page, 0xff, hashp->BSIZE);
-#endif
if (hashp->nbufs)
hashp->nbufs--;
} else {
Home |
Main Index |
Thread Index |
Old Index