Skip to content

Commit 20db128

Browse files
committed
out_vivo_exporter: fix regression on buffer check
Signed-off-by: Eduardo Silva <eduardo@chronosphere.io>
1 parent d16acdf commit 20db128

File tree

1 file changed

+7
-3
lines changed
  • plugins/out_vivo_exporter

1 file changed

+7
-3
lines changed

plugins/out_vivo_exporter/vivo.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -277,14 +277,18 @@ static flb_sds_t format_logs(struct flb_input_instance *src_ins,
277277

278278
msgpack_sbuffer_destroy(&tmp_sbuf);
279279

280-
/* append a newline */
281-
flb_sds_cat_safe(&out_js, "\n", 1);
282-
283280
if (!out_js) {
284281
flb_sds_destroy(out_buf);
285282
return NULL;
286283
}
287284

285+
/* append a newline */
286+
if (flb_sds_cat_safe(&out_js, "\n", 1) < 0) {
287+
flb_sds_destroy(out_js);
288+
flb_sds_destroy(out_buf);
289+
return NULL;
290+
}
291+
288292
/* Replace out_buf with the complete JSON */
289293
flb_sds_destroy(out_buf);
290294
return out_js;

0 commit comments

Comments
 (0)