Browse Source

[core] fix chunkqueue_compact_mem w/ partial chunk

(bug on master branch; never released)
master
Glenn Strauss 12 months ago
parent
commit
6d76f7ce49
  1. 6
      src/chunk.c

6
src/chunk.c

@ -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;

Loading…
Cancel
Save