From 6dc747b608e6683e930e9e6a546ab4f2f243c08a Mon Sep 17 00:00:00 2001 From: dillon Date: Thu, 19 Dec 2002 23:23:20 +0000 Subject: [PATCH] The zalloc pool's size calculation breaks if sbrk() does not return contiguous chunks of memory. It happens to do so in the bootstrap code, but not necessarily in other places. MFC after: 7 days --- lib/libstand/zalloc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/libstand/zalloc.c b/lib/libstand/zalloc.c index e83fccb8ced3..aa8ccd03c0fa 100644 --- a/lib/libstand/zalloc.c +++ b/lib/libstand/zalloc.c @@ -247,22 +247,22 @@ zextendPool(MemPool *mp, void *base, iaddr_t bytes) mp->mp_Base = base; mp->mp_Used = bytes; mp->mp_End = (char *)base + bytes; + mp->mp_Size = bytes; } else { void *pend = (char *)mp->mp_Base + mp->mp_Size; if (base < mp->mp_Base) { - /* mp->mp_Size += (char *)mp->mp_Base - (char *)base; */ + mp->mp_Size += (char *)mp->mp_Base - (char *)base; mp->mp_Used += (char *)mp->mp_Base - (char *)base; mp->mp_Base = base; } base = (char *)base + bytes; if (base > pend) { - /* mp->mp_Size += (char *)base - (char *)pend; */ + mp->mp_Size += (char *)base - (char *)pend; mp->mp_Used += (char *)base - (char *)pend; mp->mp_End = (char *)base; } } - mp->mp_Size += bytes; } #ifdef ZALLOCDEBUG