mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-11 20:00:07 +00:00
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].
This commit is contained in:
parent
7a0dcfc643
commit
77dc0d8643
@ -1,5 +1,8 @@
|
|||||||
2019-02-04 Joseph Myers <joseph@codesourcery.com>
|
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
|
* nscd/connections.c (reqinfo): Initialize SHUTDOWN element only
|
||||||
once.
|
once.
|
||||||
|
|
||||||
|
@ -2946,7 +2946,7 @@ tcache_get (size_t tc_idx)
|
|||||||
{
|
{
|
||||||
tcache_entry *e = tcache->entries[tc_idx];
|
tcache_entry *e = tcache->entries[tc_idx];
|
||||||
assert (tc_idx < TCACHE_MAX_BINS);
|
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->entries[tc_idx] = e->next;
|
||||||
--(tcache->counts[tc_idx]);
|
--(tcache->counts[tc_idx]);
|
||||||
e->key = NULL;
|
e->key = NULL;
|
||||||
|
Loading…
Reference in New Issue
Block a user