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 20241014 #62

Merged
merged 2 commits into from
Oct 14, 2024
Merged
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
14 changes: 8 additions & 6 deletions src/ctr_encode_opentelemetry.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ static inline void otlp_array_destroy(Opentelemetry__Proto__Common__V1__ArrayVal

static inline void otlp_kvpair_list_destroy(Opentelemetry__Proto__Common__V1__KeyValue **pair_list, size_t entry_count);

static void destroy_spans(Opentelemetry__Proto__Trace__V1__Span **spans, size_t count);

static inline void otlp_kvpair_destroy(Opentelemetry__Proto__Common__V1__KeyValue *kvpair)
{
if (kvpair != NULL) {
Expand Down Expand Up @@ -425,8 +427,7 @@ static inline Opentelemetry__Proto__Common__V1__AnyValue *ctr_variant_string_to_

if (result->string_value == NULL) {
otlp_any_value_destroy(result);

result = NULL;
return NULL;
}
}

Expand Down Expand Up @@ -484,8 +485,8 @@ static inline Opentelemetry__Proto__Common__V1__AnyValue *ctr_variant_binary_to_

if (result->bytes_value.data == NULL) {
otlp_any_value_destroy(result);

result = NULL;

}

memcpy(result->bytes_value.data, value->data.as_bytes, result->bytes_value.len);
Expand Down Expand Up @@ -884,6 +885,9 @@ static Opentelemetry__Proto__Trace__V1__Span **set_spans(struct ctrace_scope_spa

otel_span = initialize_span();
if (!otel_span) {
if (span_index > 0) {
destroy_spans(spans, span_index);
}
return NULL;
}

Expand Down Expand Up @@ -992,9 +996,7 @@ static Opentelemetry__Proto__Trace__V1__ScopeSpans **set_scope_spans(struct ctra
if (scope_span_index > 0) {
destroy_scope_spans(scope_spans, scope_span_index - 1);
}

free(scope_spans);

/* note: scope_spans is freed inside destroy_scope_spans() */
return NULL;
}

Expand Down
Loading