From ce5fa17b5a14d73c6a84823365b3a3773cb8ee78 Mon Sep 17 00:00:00 2001 From: zhb192729 Date: Thu, 19 Sep 2024 13:39:32 +0800 Subject: [PATCH] fix review --- core/metadata/k8sMetadata.cpp | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/core/metadata/k8sMetadata.cpp b/core/metadata/k8sMetadata.cpp index 1dabc56064..0239725df9 100644 --- a/core/metadata/k8sMetadata.cpp +++ b/core/metadata/k8sMetadata.cpp @@ -103,10 +103,7 @@ namespace logtail { std::string errors; if (reader->parse(res.mBody.c_str(), res.mBody.c_str() + res.mBody.size(), &root, &errors)) { - std::shared_ptr data = std::make_unique(); - if (data == nullptr) { - return true; - } + std::shared_ptr data = std::make_shared(); FromContainerJson(root, data); for (const auto& pair : data->containers) { if (infoType == containerInfoType::ContainerIdInfo) { @@ -150,7 +147,7 @@ namespace logtail { } void K8sMetadata::SetContainerCache(const Json::Value& root) { - std::shared_ptr data = std::make_unique(); + std::shared_ptr data = std::make_shared(); if (data == nullptr) { return; } @@ -161,7 +158,7 @@ namespace logtail { } void K8sMetadata::SetIpCache(const Json::Value& root) { - std::shared_ptr data = std::make_unique(); + std::shared_ptr data = std::make_shared(); if (data == nullptr) { return; }