From 0c11d8a9c37e7f50ec003feef6ab8ae7b50b9000 Mon Sep 17 00:00:00 2001 From: Wesley Pettit Date: Fri, 3 Jul 2020 20:07:04 -0700 Subject: [PATCH] out_cloudwatch_logs: fix mem leak in init (CID 304902) Signed-off-by: Wesley Pettit --- plugins/out_cloudwatch_logs/cloudwatch_logs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plugins/out_cloudwatch_logs/cloudwatch_logs.c b/plugins/out_cloudwatch_logs/cloudwatch_logs.c index f7273861dde..4a28d6f16ac 100644 --- a/plugins/out_cloudwatch_logs/cloudwatch_logs.c +++ b/plugins/out_cloudwatch_logs/cloudwatch_logs.c @@ -55,7 +55,7 @@ static int cb_cloudwatch_init(struct flb_output_instance *ins, struct flb_config *config, void *data) { const char *tmp; - char *session_name; + char *session_name = NULL; struct flb_cloudwatch *ctx = NULL; struct cw_flush *buf = NULL; int ret; @@ -327,6 +327,7 @@ static int cb_cloudwatch_init(struct flb_output_instance *ins, return 0; error: + free(session_name); flb_plg_error(ctx->ins, "Initialization failed"); flb_cloudwatch_ctx_destroy(ctx); return -1;