Skip to content

Commit be01fc2

Browse files
aalkinclaude
andcommitted
Store service names as std::string in ServiceRegistry
Meta::name was a strdup'ed char const* that was never freed. Use std::string. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 271c627 commit be01fc2

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎Framework/Core/include/Framework/ServiceRegistry.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ struct ServiceRegistry {
112112
// the service.
113113
struct Meta {
114114
ServiceKind kind = ServiceKind::Serial;
115-
char const* name = nullptr;
115+
std::string name;
116116
// The index in the
117117
SpecIndex specIndex{};
118118
};

‎Framework/Core/src/ServiceRegistry.cxx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ void ServiceRegistry::registerService(ServiceTypeHash typeHash, void* service, S
9494
if (mServicesBooked[i + index.index].compare_exchange_strong(expected, true,
9595
std::memory_order_seq_cst)) {
9696
mServicesValue[i + index.index] = service;
97-
mServicesMeta[i + index.index] = Meta{kind, name ? strdup(name) : nullptr, specIndex};
97+
mServicesMeta[i + index.index] = Meta{kind, name ? std::string(name) : std::string{""}, specIndex};
9898
mServicesKey[i + index.index] = Key{.typeHash = typeHash, .salt = salt};
9999
std::atomic_thread_fence(std::memory_order_release);
100100
return;

0 commit comments

Comments
 (0)