[core] fix chunkqueue_compact_mem w/ partial chunk

(bug on master branch; never released)
This commit is contained in:
Glenn Strauss 2020-10-11 10:50:55 -04:00
parent 8abbf621d1
commit 6d76f7ce49
1 changed files with 5 additions and 1 deletions

View File

@ -779,7 +779,11 @@ void chunkqueue_compact_mem(chunkqueue *cq, size_t clen) {
}
for (chunk *fc = c; ((clen -= len) && (c = fc->next)); ) {
len = buffer_string_length(c->mem) - c->offset;
if (len > clen) len = clen;
if (len > clen) {
buffer_append_string_len(b, c->mem->ptr + c->offset, clen);
c->offset += clen;
break;
}
buffer_append_string_len(b, c->mem->ptr + c->offset, len);
fc->next = c->next;
if (NULL == c->next) cq->last = fc;