snac2

Fork of https://codeberg.org/grunfink/snac2
git clone https://git.inz.fi/snac2
Log | Files | Refs | README | LICENSE

commit aa0b8732aa375440b81e176dcc868ed3540c302d
parent 9e9d740199e11ca79463f9f4df6f55f0e25cc1aa
Author: default <nobody@localhost>
Date:   Mon, 10 Apr 2023 15:12:09 +0200

Merge https://codeberg.org/grunfink/snac2

Diffstat:
Mxs.h | 6+++---
Mxs_curl.h | 2+-
2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/xs.h b/xs.h @@ -1057,12 +1057,12 @@ xs_data *xs_data_new(const void *data, int size) xs_data *v; /* add the overhead (data type + 24bit size) */ - size += 4; + int total_size = size + 4; - v = xs_realloc(NULL, _xs_blk_size(size)); + v = xs_realloc(NULL, _xs_blk_size(total_size)); v[0] = XSTYPE_DATA; - _xs_put_24b(v + 1, size); + _xs_put_24b(v + 1, total_size); memcpy(&v[4], data, size); diff --git a/xs_curl.h b/xs_curl.h @@ -55,7 +55,7 @@ static int _data_callback(void *buffer, size_t size, /* open space */ pd->size += sz; - pd->data = xs_realloc(pd->data, pd->size + 1); + pd->data = xs_realloc(pd->data, _xs_blk_size(pd->size + 1)); /* copy data */ memcpy(pd->data + pd->offset, buffer, sz);