From 542dfa448742a64d2047efc42c6ab09a94a90834 Mon Sep 17 00:00:00 2001 From: David Korczynski Date: Fri, 30 Jun 2023 05:11:43 -0700 Subject: [PATCH 1/2] out_logdna: remove unused store `len` is assigned but never used. No need for the operations related to this. Signed-off-by: David Korczynski --- plugins/out_logdna/logdna.c | 1 - 1 file changed, 1 deletion(-) diff --git a/plugins/out_logdna/logdna.c b/plugins/out_logdna/logdna.c index 798159f6d40..4ea05392ac7 100644 --- a/plugins/out_logdna/logdna.c +++ b/plugins/out_logdna/logdna.c @@ -305,7 +305,6 @@ static struct flb_logdna *logdna_config_create(struct flb_output_instance *ins, tmp = NULL; hostname = (char *) flb_env_get(config->env, "HOSTNAME"); if (hostname) { - len = strlen(hostname); ctx->_hostname = flb_sds_create(hostname); } else { From 768483d1f4ca64a6699821aef79df61ca6e5d2d3 Mon Sep 17 00:00:00 2001 From: David Korczynski Date: Tue, 8 Aug 2023 09:56:44 -0700 Subject: [PATCH 2/2] out_logdna: adjust error checking Signed-off-by: David Korczynski --- plugins/out_logdna/logdna.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/plugins/out_logdna/logdna.c b/plugins/out_logdna/logdna.c index 4ea05392ac7..e3ab9f56fa9 100644 --- a/plugins/out_logdna/logdna.c +++ b/plugins/out_logdna/logdna.c @@ -310,15 +310,17 @@ static struct flb_logdna *logdna_config_create(struct flb_output_instance *ins, else { ctx->_hostname = flb_sds_create("unknown"); } - if (!ctx->_hostname) { - flb_free(ctx); - return NULL; - } } else { ctx->_hostname = flb_sds_create(ctx->hostname); } + /* Bail if unsuccessful hostname creation */ + if (!ctx->_hostname) { + flb_free(ctx); + return NULL; + } + /* Create Upstream connection context */ upstream = flb_upstream_create(config, ctx->logdna_host,