diff --git a/plugins/in_cpu/in_cpu.c b/plugins/in_cpu/in_cpu.c index 4f446341c77..4b783f27052 100644 --- a/plugins/in_cpu/in_cpu.c +++ b/plugins/in_cpu/in_cpu.c @@ -158,6 +158,9 @@ void *in_cpu_flush(void *in_context, int *size) msgpack_sbuffer *sbuf; struct flb_in_cpu_config *ctx = in_context; + if (ctx->data_idx == 0) + return NULL; + sbuf = &ctx->mp_sbuf; *size = sbuf->size; buf = malloc(sbuf->size); diff --git a/plugins/in_kmsg/in_kmsg.c b/plugins/in_kmsg/in_kmsg.c index 152c320f19a..a366067d9ca 100644 --- a/plugins/in_kmsg/in_kmsg.c +++ b/plugins/in_kmsg/in_kmsg.c @@ -107,6 +107,9 @@ void *in_kmsg_flush(void *in_context, int *size) msgpack_sbuffer *sbuf; struct flb_in_kmsg_config *ctx = in_context; + if (ctx->buffer_id == 0) + return NULL; + sbuf = &ctx->mp_sbuf; *size = sbuf->size; buf = malloc(sbuf->size); diff --git a/plugins/in_mem/in_mem.c b/plugins/in_mem/in_mem.c index cc2db0d4f27..72d24eee7c7 100644 --- a/plugins/in_mem/in_mem.c +++ b/plugins/in_mem/in_mem.c @@ -99,6 +99,9 @@ void *in_mem_flush(void *in_context, int *size) char *buf; struct flb_in_mem_config *ctx = in_context; + if (ctx->idx == 0) + return NULL; + buf = malloc(ctx->sbuf.size); if (!buf) { return NULL;