Skip to content

Commit 5f2d4d4

Browse files
committed
fix: uninit values
1 parent 6b48dab commit 5f2d4d4

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/datadog/baggage.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,11 @@ void Baggage::visit(std::function<void(StringView, StringView)>&& visitor) {
130130
}
131131

132132
Expected<void> Baggage::inject(DictWriter& writer, size_t max_bytes) const {
133+
if (baggage_.empty()) return {};
134+
135+
// TODO(@dmehala): Memory alloc optimization, (re)use fixed size buffer.
133136
std::string res;
137+
res.reserve(max_bytes);
134138

135139
auto it = baggage_.cbegin();
136140
res += it->first;

src/datadog/tracer.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,9 @@ Tracer::Tracer(const FinalizedTracerConfig& config,
5959
tags_header_max_size_(config.tags_header_size),
6060
sampling_delegation_enabled_(config.delegate_trace_sampling),
6161
baggage_max_items_(config.baggage_max_items),
62-
baggage_max_bytes_(config.baggage_max_bytes) {
62+
baggage_max_bytes_(config.baggage_max_bytes),
63+
baggage_injection_enabled_(false),
64+
baggage_extraction_enabled_(false) {
6365
if (config.report_hostname) {
6466
hostname_ = get_hostname();
6567
}

0 commit comments

Comments
 (0)