replay: fix dangling pointers in logging calls (#36738)

fix dangling pointers in logging calls
This commit is contained in:
Dean Lee
2025-12-02 05:32:21 +08:00
committed by GitHub
parent 8ffe3f287e
commit 693c83f74c
2 changed files with 7 additions and 2 deletions
+5 -1
View File
@@ -31,6 +31,8 @@ void Replay::setupServices(const std::vector<std::string> &allow, const std::vec
sockets_.resize(event_schema.getUnionFields().size(), nullptr);
std::vector<const char *> active_services;
active_services.reserve(services.size());
for (const auto &[name, _] : services) {
bool is_blocked = std::find(block.begin(), block.end(), name) != block.end();
bool is_allowed = allow.empty() || std::find(allow.begin(), allow.end(), name) != allow.end();
@@ -40,7 +42,9 @@ void Replay::setupServices(const std::vector<std::string> &allow, const std::vec
active_services.push_back(name.c_str());
}
}
rInfo("active services: %s", join(active_services, ", ").c_str());
std::string services_str = join(active_services, ", ");
rInfo("active services: %s", services_str.c_str());
if (!sm_) {
pm_ = std::make_unique<PubMaster>(active_services);
}
+2 -1
View File
@@ -91,7 +91,8 @@ bool SegmentManager::mergeSegments(const SegmentMap::iterator &begin, const Segm
auto &merged_events = merged_event_data->events;
merged_events.reserve(total_event_count);
rDebug("merging segments: %s", join(segments_to_merge, ", ").c_str());
std::string segments_str = join(segments_to_merge, ", ");
rDebug("merging segments: %s", segments_str.c_str());
for (int n : segments_to_merge) {
const auto &events = segments_.at(n)->log->events;
if (events.empty()) continue;