Skip to content

Commit

Permalink
Add null check in ProcessToken constuctor/destructor
Browse files Browse the repository at this point in the history
  • Loading branch information
bugos committed Dec 2, 2024
1 parent 737525b commit d8183d2
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Source/santad/ProcessTree/process_tree.cc
Original file line number Diff line number Diff line change
Expand Up @@ -308,9 +308,17 @@ Tokens
ProcessToken::ProcessToken(std::shared_ptr<ProcessTree> tree,
std::vector<struct Pid> pids)
: tree_(std::move(tree)), pids_(std::move(pids)) {
if (tree_ == nullptr) {
return;
}
tree_->RetainProcess(pids);
}

ProcessToken::~ProcessToken() { tree_->ReleaseProcess(pids_); }
ProcessToken::~ProcessToken() {
if (tree_ == nullptr) {
return;
}
tree_->ReleaseProcess(pids_);
}

} // namespace santa::santad::process_tree

0 comments on commit d8183d2

Please sign in to comment.