malloc: fix freelist corruption.

This commit is contained in:
yamt 2008-01-03 01:21:08 +00:00
parent c8ad2035a8
commit 2129f3c054
1 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: kern_malloc.c,v 1.116 2007/12/05 07:06:52 ad Exp $ */
/* $NetBSD: kern_malloc.c,v 1.117 2008/01/03 01:21:08 yamt Exp $ */
/*
* Copyright (c) 1987, 1991, 1993
@ -66,7 +66,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.116 2007/12/05 07:06:52 ad Exp $");
__KERNEL_RCSID(0, "$NetBSD: kern_malloc.c,v 1.117 2008/01/03 01:21:08 yamt Exp $");
#include <sys/param.h>
#include <sys/proc.h>
@ -429,7 +429,7 @@ malloc(unsigned long size, struct malloc_type *ksp, int flags)
freep->next = cp;
}
freep->next = savedlist;
if (kbp->kb_last == NULL)
if (savedlist == NULL)
kbp->kb_last = (void *)freep;
}
va = kbp->kb_next;