Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverity: fixes as of 20240830 (CID 507960) #9318

Merged
merged 3 commits into from
Sep 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions plugins/out_calyptia/calyptia.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ static int cb_calyptia_init(struct flb_output_instance *ins,

#ifdef FLB_HAVE_CHUNK_TRACE
ctx->trace_endpoint = flb_sds_create_size(256);
flb_sds_printf(&ctx->trace_endpoint, CALYPTIA_ENDPOINT_TRACE,
flb_sds_printf(&ctx->trace_endpoint, CALYPTIA_ENDPOINT_TRACE,
ctx->pipeline_id);
#endif /* FLB_HAVE_CHUNK_TRACE */
return 0;
Expand Down Expand Up @@ -790,7 +790,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
void *out_context,
struct flb_config *config)
{
int ret;
int ret = FLB_RETRY;
size_t off = 0;
size_t out_size = 0;
char *out_buf = NULL;
Expand All @@ -801,7 +801,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
#endif /* FLB_HAVE_CHUNK_TRACE */

struct flb_connection *u_conn;
struct flb_http_client *c;
struct flb_http_client *c = NULL;
struct flb_calyptia *ctx = out_context;
struct cmt *cmt;
(void) i_ins;
Expand Down Expand Up @@ -867,7 +867,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
cmt_encode_msgpack_destroy(out_buf);
}
}

#ifdef FLB_HAVE_CHUNK_TRACE
if (event_chunk->type == (FLB_EVENT_TYPE_LOGS | FLB_EVENT_TYPE_HAS_TRACE)) {
json = flb_pack_msgpack_to_json_format(event_chunk->data,
Expand Down Expand Up @@ -896,7 +896,7 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
flb_sds_destroy(ctx->metrics_endpoint);
FLB_OUTPUT_RETURN(FLB_RETRY);
}

/* perform request: 'ret' might be FLB_OK, FLB_ERROR or FLB_RETRY */
ret = calyptia_http_do(ctx, c, CALYPTIA_ACTION_TRACE);
if (ret == FLB_OK) {
Expand All @@ -911,7 +911,10 @@ static void cb_calyptia_flush(struct flb_event_chunk *event_chunk,
#endif /* FLB_HAVE_CHUNK_TRACE */

flb_upstream_conn_release(u_conn);
flb_http_client_destroy(c);

if (c) {
flb_http_client_destroy(c);
}
FLB_OUTPUT_RETURN(ret);
}

Expand Down
4 changes: 2 additions & 2 deletions plugins/out_opentelemetry/opentelemetry_logs.c
Original file line number Diff line number Diff line change
Expand Up @@ -482,7 +482,7 @@ static int append_v1_logs_metadata_and_fields(struct opentelemetry_context *ctx,
}

if (!severity_number_set && ctx->ra_severity_number_message) {
ra_val = flb_ra_get_value_object(ctx->ra_severity_number_metadata, *event->body);
ra_val = flb_ra_get_value_object(ctx->ra_severity_number_message, *event->body);
if (ra_val != NULL) {
if (ra_val->o.type == MSGPACK_OBJECT_POSITIVE_INTEGER && is_valid_severity_number(ra_val->o.via.u64)) {
log_record->severity_number = ra_val->o.via.u64;
Expand Down Expand Up @@ -640,7 +640,7 @@ static int append_v1_logs_metadata_and_fields(struct opentelemetry_context *ctx,
flb_ra_key_value_destroy(ra_val);
}

if (!trace_flags_set && ctx->ra_trace_flags_metadata) {
if (!trace_flags_set) {
ra_val = flb_ra_get_value_object(ctx->ra_trace_flags_metadata, *event->metadata);
if (ra_val != NULL) {
if (ra_val->o.type == MSGPACK_OBJECT_POSITIVE_INTEGER) {
Expand Down
Loading