Skip to content

Commit fe06ffd

Browse files
committed
fix(colors): small memory leak of lcms transform objects
1 parent a455211 commit fe06ffd

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/imageio/Colors.cpp

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -915,6 +915,12 @@ Task<void> toLinearSrgbPremul(
915915
const size_t numPixels = posProd(size);
916916

917917
cmsHTRANSFORM transform = nullptr;
918+
const auto transformGuard = ScopeGuard{[&transform]() {
919+
if (transform) {
920+
cmsDeleteTransform(transform);
921+
}
922+
}};
923+
918924
if (cicp) {
919925
tlog::debug(
920926
"Performing CICP color transform: alphaKind={} type={:#010x} channels={}->{} typeOut={:#010x} intent={}",
@@ -959,7 +965,7 @@ Task<void> toLinearSrgbPremul(
959965
}
960966
}
961967

962-
const auto guard = ScopeGuard{[now = chrono::system_clock::now()]() {
968+
const auto timingGuard = ScopeGuard{[now = chrono::system_clock::now()]() {
963969
const auto duration = chrono::duration_cast<chrono::duration<double>>(chrono::system_clock::now() - now);
964970
tlog::debug("ICC profile application took {:.03}s", duration.count());
965971
}};

0 commit comments

Comments
 (0)