aboutsummaryrefslogtreecommitdiff
path: root/nscd/mem.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2008-05-18 04:25:44 +0000
committerUlrich Drepper <drepper@redhat.com>2008-05-18 04:25:44 +0000
commitfa526148d6d78bf97f5628a023d290d071b47592 (patch)
tree174a71fb9489261f7ab72cba4cf8073a3a3bfa76 /nscd/mem.c
parent77d40f10ecc05ede24ae4f34d75f920ddf94a773 (diff)
downloadglibc-fa526148d6d78bf97f5628a023d290d071b47592.zip
glibc-fa526148d6d78bf97f5628a023d290d071b47592.tar.gz
glibc-fa526148d6d78bf97f5628a023d290d071b47592.tar.bz2
* nscd/mem.c (gc): Correctly determine highest used array element
in mark.
Diffstat (limited to 'nscd/mem.c')
-rw-r--r--nscd/mem.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/nscd/mem.c b/nscd/mem.c
index 0bcb2aa..bf3777d 100644
--- a/nscd/mem.c
+++ b/nscd/mem.c
@@ -131,8 +131,8 @@ gc (struct database_dyn *db)
size_t stack_used = sizeof (bool) * db->head->module;
if (__builtin_expect (stack_used > MAX_STACK_USE, 0))
stack_used = 0;
- size_t memory_needed = ((db->head->first_free / BLOCK_ALIGN + BITS - 1)
- / BITS) * sizeof (BITMAP_T);
+ size_t nmark = (db->head->first_free / BLOCK_ALIGN + BITS - 1) / BITS;
+ size_t memory_needed = nmark * sizeof (BITMAP_T);
if (stack_used + memory_needed <= MAX_STACK_USE)
{
mark = (BITMAP_T *) alloca (memory_needed);
@@ -234,7 +234,7 @@ gc (struct database_dyn *db)
qsort (he, cnt, sizeof (struct hashentry *), sort_he);
/* Determine the highest used address. */
- size_t high = sizeof (mark);
+ size_t high = nmark;
while (high > 0 && mark[high - 1] == 0)
--high;