Skip to content

Commit

Permalink
clang-analyzer: fix NewDelete error
Browse files Browse the repository at this point in the history
add calls doAdd which calls push_back and release(). It's more reliable
to call back() in this case as the formerly unique_ptr is at the end.

Signed-off-by: Rosen Penev <[email protected]>
  • Loading branch information
neheb committed Feb 3, 2025
1 parent ed006d6 commit 8715d78
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/crwimage_int.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -555,8 +555,8 @@ CiffComponent* CiffDirectory::doAdd(CrwDirs& crwDirs, uint16_t crwTagId) {
if (!cc) {
// Directory doesn't exist yet, add it
auto m = std::make_unique<CiffDirectory>(dir.dir, dir.parent);
cc = m.get();
add(std::move(m));
cc = components_.back();
}
// Recursive call to next lower level directory
return cc->add(crwDirs, crwTagId);
Expand All @@ -571,8 +571,8 @@ CiffComponent* CiffDirectory::doAdd(CrwDirs& crwDirs, uint16_t crwTagId) {
if (!cc) {
// Tag doesn't exist yet, add it
auto m = std::make_unique<CiffEntry>(crwTagId, tag());
cc = m.get();
add(std::move(m));
cc = components_.back();
}
return cc;
} // CiffDirectory::doAdd
Expand Down

0 comments on commit 8715d78

Please sign in to comment.