aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2014-04-18 20:28:46 -0400
committerNick Mathewson <nickm@torproject.org>2014-04-18 20:28:46 -0400
commit41a8930fa1202b882687c0c3a328307b480934b5 (patch)
treeacd83cbd33ab07e4f0e91fb9640c9d3358d5704a /src
parent08325b58bef83bfed181c493f269ef57477152c0 (diff)
downloadtor-41a8930fa1202b882687c0c3a328307b480934b5.tar.gz
tor-41a8930fa1202b882687c0c3a328307b480934b5.zip
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.
Diffstat (limited to 'src')
-rw-r--r--src/or/buffers.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/or/buffers.c b/src/or/buffers.c
index 012ced6d32..fb186081cf 100644
--- a/src/or/buffers.c
+++ b/src/or/buffers.c
@@ -322,7 +322,7 @@ buf_shrink_freelists(int free_all)
chunk_t **chp = &freelists[i].head;
chunk_t *chunk;
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 "
"%d-byte chunks, but only found %d. (Length %d)",
orig_n_to_skip, (int)freelists[i].alloc_size,