Skip to content

Commit

Permalink
pack: ensure minimum allocation is 256 bytes (unit test)
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Silva <[email protected]>
  • Loading branch information
edsiper committed Feb 1, 2022
1 parent b274c6e commit c84b7cf
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/flb_pack.c
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,9 @@ flb_sds_t flb_msgpack_raw_to_json_sds(const void *in_buf, size_t in_size)
/* buffer size strategy */
out_size = in_size * 2;
realloc_size = in_size * 0.10;
if (realloc_size < 256) {
realloc_size = 256;
}

out_buf = flb_sds_create_size(out_size);
if (!out_buf) {
Expand Down

0 comments on commit c84b7cf

Please sign in to comment.