Skip to content

Commit

Permalink
fix memory leak
Browse files Browse the repository at this point in the history
  • Loading branch information
critical27 committed Dec 3, 2021
1 parent c991256 commit 4afd09b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion src/storage/mutate/AddEdgesProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ void AddEdgesProcessor::doProcessWithIndex(const cpp2::AddEdgesRequest& req) {
break;
}
if (*edgeKey.edge_type_ref() > 0) {
std::string oldVal;
RowReaderWrapper nReader;
RowReaderWrapper oReader;
if (!ignoreExistedIndex_) {
Expand All @@ -229,8 +230,9 @@ void AddEdgesProcessor::doProcessWithIndex(const cpp2::AddEdgesRequest& req) {
continue;
}
if (!nebula::value(obsIdx).empty()) {
oldVal = std::move(value(obsIdx));
oReader = RowReaderWrapper::getEdgePropReader(
env_->schemaMan_, spaceId_, *edgeKey.edge_type_ref(), nebula::value(obsIdx));
env_->schemaMan_, spaceId_, *edgeKey.edge_type_ref(), oldVal);
}
} else {
code = nebula::error(obsIdx);
Expand Down
6 changes: 4 additions & 2 deletions src/storage/mutate/AddVerticesProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,17 @@ void AddVerticesProcessor::doProcessWithIndex(const cpp2::AddVerticesRequest& re

RowReaderWrapper nReader;
RowReaderWrapper oReader;
std::string oldVal;
if (!ignoreExistedIndex_) {
auto obsIdx = findOldValue(partId, vid, tagId);
if (nebula::ok(obsIdx)) {
if (ifNotExists_ && !nebula::value(obsIdx).empty()) {
continue;
}
if (!nebula::value(obsIdx).empty()) {
oReader = RowReaderWrapper::getTagPropReader(
env_->schemaMan_, spaceId_, tagId, nebula::value(obsIdx));
oldVal = std::move(value(obsIdx));
oReader =
RowReaderWrapper::getTagPropReader(env_->schemaMan_, spaceId_, tagId, oldVal);
}
} else {
code = nebula::error(obsIdx);
Expand Down

0 comments on commit 4afd09b

Please sign in to comment.