diff options
author | dillon <dillon@FreeBSD.org> | 2002-12-19 23:23:20 +0000 |
---|---|---|
committer | dillon <dillon@FreeBSD.org> | 2002-12-19 23:23:20 +0000 |
commit | 6dc747b608e6683e930e9e6a546ab4f2f243c08a (patch) | |
tree | 9f6aea8d1dfc9e81e8a0523ca73fac3366e0e0ca /lib | |
parent | 514c635ee6d3ff47b542ec91a037e7a241c1357c (diff) | |
download | FreeBSD-src-6dc747b608e6683e930e9e6a546ab4f2f243c08a.zip FreeBSD-src-6dc747b608e6683e930e9e6a546ab4f2f243c08a.tar.gz |
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
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libstand/zalloc.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libstand/zalloc.c b/lib/libstand/zalloc.c index e83fccb..aa8ccd0 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 |