Skip to content

Commit 5f613ae

Browse files
committed
Revert "clang-tidy: use release() on dynamic_cast"
This reverts commit 44d41c4. This was a bugfix to clang-tidy complaining about the result of release() being unused. Unfortunately it introduced a memory leak. Solve it differently.
1 parent 7c2b282 commit 5f613ae

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/tiffcomposite_int.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -553,10 +553,11 @@ TiffComponent* TiffDirectory::doAddChild(TiffComponent::UniquePtr tiffComponent)
553553
} // TiffDirectory::doAddChild
554554

555555
TiffComponent* TiffSubIfd::doAddChild(TiffComponent::UniquePtr tiffComponent) {
556-
auto d = dynamic_cast<TiffDirectory*>(tiffComponent.release());
556+
auto d = dynamic_cast<TiffDirectory*>(tiffComponent.get());
557557
if (!d) {
558558
throw Error(ErrorCode::kerErrorMessage, "dynamic_cast to TiffDirectory failed");
559559
}
560+
tiffComponent.release(); // NOLINT(clang-analyzer-cplusplus.NewDeleteLeaks)
560561
return ifds_.emplace_back(d).get();
561562
} // TiffSubIfd::doAddChild
562563

0 commit comments

Comments
 (0)