about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--malloc/malloc.c2
2 files changed, 4 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index d73c815c37..17d53b181a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2019-02-04  Joseph Myers  <joseph@codesourcery.com>
 
+	* malloc/malloc.c (tcache_get): Compare tcache->counts[tc_idx]
+	with 0, not tcache->entries[tc_idx].
+
 	* nscd/connections.c (reqinfo): Initialize SHUTDOWN element only
 	once.
 
diff --git a/malloc/malloc.c b/malloc/malloc.c
index feaf7ee0bf..13fc1f2049 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2946,7 +2946,7 @@ tcache_get (size_t tc_idx)
 {
   tcache_entry *e = tcache->entries[tc_idx];
   assert (tc_idx < TCACHE_MAX_BINS);
-  assert (tcache->entries[tc_idx] > 0);
+  assert (tcache->counts[tc_idx] > 0);
   tcache->entries[tc_idx] = e->next;
   --(tcache->counts[tc_idx]);
   e->key = NULL;