summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorphk <phk@FreeBSD.org>1996-08-04 20:08:48 +0000
committerphk <phk@FreeBSD.org>1996-08-04 20:08:48 +0000
commit0a7364f8a41b9b1a7176fb25268378511aea415d (patch)
tree1fb3346ca291bc4aa27a7df7c2558a1788e0f304
parent6f2088ae442e431b3ffcb262e9008914a103039e (diff)
downloadFreeBSD-src-0a7364f8a41b9b1a7176fb25268378511aea415d.zip
FreeBSD-src-0a7364f8a41b9b1a7176fb25268378511aea415d.tar.gz
The check for multiple freed items were bogus. fixed.
-rw-r--r--sys/kern/kern_malloc.c19
1 files changed, 12 insertions, 7 deletions
diff --git a/sys/kern/kern_malloc.c b/sys/kern/kern_malloc.c
index 5375d6d..de6ec55 100644
--- a/sys/kern/kern_malloc.c
+++ b/sys/kern/kern_malloc.c
@@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)kern_malloc.c 8.3 (Berkeley) 1/4/94
- * $Id: kern_malloc.c,v 1.22 1996/05/10 19:28:48 wollman Exp $
+ * $Id: kern_malloc.c,v 1.23 1996/05/18 22:33:13 dyson Exp $
*/
#include <sys/param.h>
@@ -263,7 +263,7 @@ free(addr, type)
long size;
int s;
#ifdef DIAGNOSTIC
- caddr_t cp;
+ struct freelist *fp;
long *end, *lp, alloc, copysize;
#endif
#ifdef KMEMSTATS
@@ -318,11 +318,16 @@ free(addr, type)
* it looks free before laboriously searching the freelist.
*/
if (freep->spare0 == WEIRD_ADDR) {
- for (cp = kbp->kb_next; cp; cp = *(caddr_t *)cp) {
- if (addr != cp)
- continue;
- printf("multiply freed item %p\n", addr);
- panic("free: duplicated free");
+ fp = (struct freelist *)kbp->kb_next;
+ while (fp) {
+ if (fp->spare0 != WEIRD_ADDR) {
+ printf("trashed free item %p\n", fp);
+ panic("free: free item modified");
+ } else if (addr == (caddr_t)fp) {
+ printf("multiple freed item %p\n", addr);
+ panic("free: multiple free");
+ }
+ fp = (struct freelist *)fp->next;
}
}
/*
OpenPOWER on IntegriCloud