summaryrefslogtreecommitdiff
path: root/malloc
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2019-02-04 23:46:58 +0000
committerArjun Shankar <ashankar@redhat.com>2019-10-30 11:56:49 +0100
commit3640758943c856268bc12a3307838c2a65d2f9ea (patch)
treead0dfe988c84423574f0f076b84421d6c69aaff1 /malloc
parentb58bace7cede42c31c8047907b1e7ad318d24c32 (diff)
downloadglibc-3640758943c856268bc12a3307838c2a65d2f9ea.tar.gz
Fix assertion in malloc.c:tcache_get.
One of the warnings that appears with -Wextra is "ordered comparison of pointer with integer zero" in malloc.c:tcache_get, for the assertion: assert (tcache->entries[tc_idx] > 0); Indeed, a "> 0" comparison does not make sense for tcache->entries[tc_idx], which is a pointer. My guess is that tcache->counts[tc_idx] is what's intended here, and this patch changes the assertion accordingly. Tested for x86_64. * malloc/malloc.c (tcache_get): Compare tcache->counts[tc_idx] with 0, not tcache->entries[tc_idx]. (cherry picked from commit 77dc0d8643aa99c92bf671352b0a8adde705896f)
Diffstat (limited to 'malloc')
-rw-r--r--malloc/malloc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 0e7970001a..78edbfc8db 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -2941,7 +2941,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;