mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 06:13:31 +01:00
scan-build: check impossible null-pointer case in buffers.c
When maintaining buffer freelists, we don't skip more than there are, so (*chp) can't be null to begin with. scan-build has no way to know that.
This commit is contained in:
parent
08325b58be
commit
41a8930fa1
@ -322,7 +322,7 @@ buf_shrink_freelists(int free_all)
|
|||||||
chunk_t **chp = &freelists[i].head;
|
chunk_t **chp = &freelists[i].head;
|
||||||
chunk_t *chunk;
|
chunk_t *chunk;
|
||||||
while (n_to_skip) {
|
while (n_to_skip) {
|
||||||
if (! (*chp)->next) {
|
if (!(*chp) || ! (*chp)->next) {
|
||||||
log_warn(LD_BUG, "I wanted to skip %d chunks in the freelist for "
|
log_warn(LD_BUG, "I wanted to skip %d chunks in the freelist for "
|
||||||
"%d-byte chunks, but only found %d. (Length %d)",
|
"%d-byte chunks, but only found %d. (Length %d)",
|
||||||
orig_n_to_skip, (int)freelists[i].alloc_size,
|
orig_n_to_skip, (int)freelists[i].alloc_size,
|
||||||
|
Loading…
Reference in New Issue
Block a user