Fix: leak of -PCC profiles in iccApplyToLink on error exit paths (#1336)#1339
Merged
xsscx merged 1 commit intoJun 14, 2026
Conversation
…ernationalColorConsortium#1336) iccApplyToLink opens each -PCC profile and tracks it in pccList, freeing the list only after cmm.Begin() has consumed the connection conditions. The three error-exit paths before that point returned without freeing pccList: - -PCC open failure (frees earlier-iteration entries) - AddXform failure (e.g. icCmmStatBadSpaceLink when a profile does not connect to the chain) -- the path the issue's repro hits - Begin() failure so the accumulated -PCC profiles leaked. Surfaced by the iccApplyToLink CI repro under ASan (InternationalColorConsortium#1336): an indirect leak of the -PCC profile via CIccProfile::ReadBasic (IccProfile.cpp:1363) opened at iccApplyToLink.cpp; the tool's stdout error was simply lost to LeakSanitizer's exit, which is why the run looked silent. Centralize the release in releasePccList() and call it on every exit path. The main (non-PCC) profiles are unaffected: AddXform owns and frees them on failure (InternationalColorConsortium#1327). Verified: the repro is now LSan-clean and prints its real error; valid links with and without -PCC still succeed and stay clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Maintainer note — paired with #1340 (the ASan regression). #1340 is on an upstream branch because the fork-PR automation gate blocks fork PRs from Suggested merge order: #1339 (this fix) first, then #1340. #1340 is red until this fix is on master — by design, since it reproduces the leak it guards. |
Member
|
Note: Auto-Merge is On. Merge on your Schedule. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1336 —
iccApplyToLinkleaks its-PCCprofiles when the chain fails to assemble.The tool opens each
-PCCprofile and tracks it inpccList, releasing the list only aftercmm.Begin()consumes the connection conditions. Three error-exit paths before that point returned without freeingpccList:-PCCopen failure (leaks earlier-iteration entries)AddXformfailure — e.g.icCmmStatBadSpaceLinkwhen a profile doesn't connect to the chain (the path the issue's repro hits)Begin()failureReproduction (issue's exact command, under ASan/LSan)
The
sRGBprofile doesn't connect to the spectral chain →AddXformreturnsBadSpaceLink→ earlyreturn -1strands the-PCCSpec400profile:(The tool's error message looked "silent" only because LeakSanitizer's
_exitdiscards the buffered stdout; with leak detection off it printsError - Unable to add '…' (status 2: Invalid space link).)Fix
Centralize the release in a
releasePccList()helper and call it on every exit path. The main (non--PCC) profiles are unaffected —AddXformowns and frees them on failure (#1327).Verification
-PCCstill succeed (LUT written) and stay ASan/LSan-clean — the success-path cleanup is the same delete loop, just factored into the helper.🤖 Generated with Claude Code