util-buffer: expand by multiples of 4k

(cherry picked from commit 287d8360e7)
pull/12207/head
Jason Ish 2 years ago
parent 3715fe3da0
commit 093397f6b3

@ -65,6 +65,11 @@ int MemBufferExpand(MemBuffer **buffer, uint32_t expand_by) {
return -1;
}
/* Adjust expand_by to next multiple of 4k. */
if (expand_by % 4096 != 0) {
expand_by = expand_by - (expand_by % 4096) + 4096;
}
size_t total_size = (*buffer)->size + sizeof(MemBuffer) + expand_by;
MemBuffer *tbuffer = SCRealloc(*buffer, total_size);

Loading…
Cancel
Save