Skip to content

Commit

Permalink
fix review
Browse files Browse the repository at this point in the history
  • Loading branch information
NameHaibinZhang committed Sep 19, 2024
1 parent 6bd1688 commit ce5fa17
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions core/metadata/k8sMetadata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ContainerData> data = std::make_unique<ContainerData>();
if (data == nullptr) {
return true;
}
std::shared_ptr<ContainerData> data = std::make_shared<ContainerData>();
FromContainerJson(root, data);
for (const auto& pair : data->containers) {
if (infoType == containerInfoType::ContainerIdInfo) {
Expand Down Expand Up @@ -150,7 +147,7 @@ namespace logtail {
}

void K8sMetadata::SetContainerCache(const Json::Value& root) {
std::shared_ptr<ContainerData> data = std::make_unique<ContainerData>();
std::shared_ptr<ContainerData> data = std::make_shared<ContainerData>();
if (data == nullptr) {
return;
}
Expand All @@ -161,7 +158,7 @@ namespace logtail {
}

void K8sMetadata::SetIpCache(const Json::Value& root) {
std::shared_ptr<ContainerData> data = std::make_unique<ContainerData>();
std::shared_ptr<ContainerData> data = std::make_shared<ContainerData>();
if (data == nullptr) {
return;
}
Expand Down

0 comments on commit ce5fa17

Please sign in to comment.