smalloc: fix garbage collection problem
authorVincent Fu <vincent.fu@wdc.com>
Tue, 30 Jul 2019 15:00:56 +0000 (09:00 -0600)
committerVincent Fu <vincent.fu@wdc.com>
Wed, 31 Jul 2019 18:17:44 +0000 (14:17 -0400)
commit554461db6d57df00766e2c4cc7d18f1561d2fa4b
treef2fc1a64d94a32fcae15274ced68c30aa3b0e67d
parent6cc38ac03026f0d25b65e941b8682a618b66efb2
smalloc: fix garbage collection problem

If a large request arrives when pool->next_non_full points to empty
space that is insufficient to satisfy the request, pool->next_non_full
will be inappropriately advanced when the free space is followed by
lines of fully allocated space. The free space originally pointed to by
pool->next_non_full will be unavailable unless a subsequent sfree() call
frees allocated space above it. Resolve this issue by advancing
pool->next_non_full only outside the search loop and only when it points
to fully allocated space.
smalloc.c