Skip to content

Fix: leak of CIccPcsXform in CIccCmm::CheckPCSConnections on Connect failure (#1337)#1338

Merged
xsscx merged 1 commit into
InternationalColorConsortium:masterfrom
colourbill-ctrl:fix-1337-pcsxform-leaks
Jun 14, 2026
Merged

Fix: leak of CIccPcsXform in CIccCmm::CheckPCSConnections on Connect failure (#1337)#1338
xsscx merged 1 commit into
InternationalColorConsortium:masterfrom
colourbill-ctrl:fix-1337-pcsxform-leaks

Conversation

@colourbill-ctrl

Copy link
Copy Markdown
Contributor

Summary

Fixes the CIccCmm::CheckPCSConnections leak surfaced by the iccApplyToLink 200-QA ASan run (#1337):

Direct leak of 144 byte(s) in 1 object(s)
  #1 CIccCmm::CheckPCSConnections(bool)  IccProfLib/IccCmm.cpp
  #2 CIccCmm::Begin(bool, bool)
  #3 main  Tools/CmdLine/IccApplyToLink/iccApplyToLink.cpp

CheckPCSConnections builds up to three CIccPcsXform objects; each is either pushed onto the xform list (ownership transferred) or deleted. The middle block returned on a hard Connect() failure (rv != icCmmStatOk && rv != icCmmStatIdentityXform) without deleting the locally-owned pPcs — leaking it. The sibling ConnectFirst block above and the trailing block below both delete on their failure paths; this one was the outlier.

Fix

One line — delete pPcs; before the failure return, with comments documenting the ownership on each branch (transfer-to-list on success, discard on identity, free on failure).

Verification

  • Code: the fix makes the middle block consistent with its two siblings (which already delete on failure); ASan log pinpoints this exact allocation site.
  • No regression: the search -INIT success path (which exercises CheckPCSConnections' success/identity branches) stays ASan/LSan-clean.
  • The specific Connect()-hard-failure chain that triggers the leak lives in the 200-QA profile set/script (not in-tree), so no deterministic CTest is added here; the change is a self-evident missing-delete mirroring the adjacent blocks.

Scope: this addresses the CheckPCSConnections library leak (#1337). The separate tool-level pccList/-PCC drop in iccApplyToLink.cpp (#1336) is a different path and not touched here.

🤖 Generated with Claude Code

…failure (InternationalColorConsortium#1337)

CheckPCSConnections allocates a CIccPcsXform, calls Connect()/ConnectFirst(),
and either hands it to the xform list (success) or deletes it. The middle of
the three CIccPcsXform blocks returned on a hard Connect() failure
(rv != icCmmStatOk && rv != icCmmStatIdentityXform) WITHOUT deleting the
locally-owned pPcs, leaking it. The sibling ConnectFirst block above and the
trailing block below both delete on their failure paths.

Surfaced by the iccApplyToLink 200-QA ASan run (InternationalColorConsortium#1337):
  Direct leak of 144 byte(s) ... CIccCmm::CheckPCSConnections -> CIccCmm::Begin

Add the missing `delete pPcs;` before the failure return so ownership is
released on every path. The success/identity paths are unchanged; the search
-INIT success path (which exercises CheckPCSConnections) stays ASan-clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added the Source C or C++ source code changes label Jun 14, 2026

@xsscx xsscx left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2026-06-14 01:50:43 UTC

@xsscx xsscx removed the request for review from maxderhak June 14, 2026 01:51
@xsscx xsscx linked an issue Jun 14, 2026 that may be closed by this pull request
@xsscx xsscx added this to the v2.3.2.2 milestone Jun 14, 2026
@xsscx xsscx added the Merge Ready Approved, mergeable, and all CI checks passed label Jun 14, 2026
@xsscx

xsscx commented Jun 14, 2026

Copy link
Copy Markdown
Member

Note: Auto-Merge is On. Merge on your Schedule.

@colourbill-ctrl

Copy link
Copy Markdown
Contributor Author

Now verified against a real trigger from the 200-QA (attached on #1337): a -PCC-free CMYK→spectral chain leaks 168 B via CheckPCSConnections pre-fix, clean post-fix. Regression added as #1341 (merge this first, then #1341). The full 200-QA goes 148→0 leaks with this PR + #1339.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Merge Ready Approved, mergeable, and all CI checks passed Source C or C++ source code changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI c0d0fc2: Leaks to Triage using iccApplyToLink 200 QA

3 participants