Skip to content

Commit 386e373

Browse files
committed
pack_json: fix data type assignation
Signed-off-by: Eduardo Silva <[email protected]>
1 parent 1946ade commit 386e373

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/flb_pack_json.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ static int flb_pack_json_ext_internal(const char *json, size_t len,
2727
struct flb_pack_opts *opts,
2828
int require_records)
2929
{
30+
int ret;
3031
int backend;
32+
int state_out_size = 0;
3133
struct flb_pack_state *state = NULL;
3234

3335
if (!opts) {
@@ -45,12 +47,20 @@ static int flb_pack_json_ext_internal(const char *json, size_t len,
4547

4648
if (backend == FLB_PACK_JSON_BACKEND_JSMN) {
4749
if (state) {
50+
state_out_size = 0;
51+
4852
/* state for incremental reads */
4953
if (require_records) {
5054
return -1;
5155
}
5256

53-
return flb_pack_json_state(json, len, out_buf, out_size, state);
57+
ret = flb_pack_json_state(json, len, out_buf,
58+
&state_out_size, state);
59+
if (ret == 0 && out_size) {
60+
*out_size = (size_t) state_out_size;
61+
}
62+
63+
return ret;
5464
}
5565

5666
if (require_records) {

0 commit comments

Comments
 (0)