Skip to content

Fix child Tx object leak in MultiTx on init failure - #817

Open
MarkRose wants to merge 1 commit into
sm0svx:masterfrom
MarkRose:fix-multitx-child-leak
Open

Fix child Tx object leak in MultiTx on init failure#817
MarkRose wants to merge 1 commit into
sm0svx:masterfrom
MarkRose:fix-multitx-child-leak

Conversation

@MarkRose

Copy link
Copy Markdown
Contributor
  • MultiTx::initialize() creates a child Tx via TxFactory::createNamedTx()
    and then calls tx->initialize() on it. If that initialize() call fails,
    the function returned false immediately without freeing the just-created
    tx object. Since the failed tx was never added to the txs list (that only
    happens after the success check), it was never reachable from ~MultiTx()
    and leaked. Now the failure path deletes the tx before returning.

Co-Authored-By: Claude Opus 4.8 [email protected]


This PR also adds a unit test (MultiTxTest.cpp). It is auto-discovered and executed by the CTest suite proposed in #762 once that is merged; without that suite present the test file is inert and does not affect the build.

- MultiTx::initialize() creates a child Tx via TxFactory::createNamedTx()
  and then calls tx->initialize() on it. If that initialize() call fails,
  the function returned false immediately without freeing the just-created
  tx object. Since the failed tx was never added to the txs list (that only
  happens after the success check), it was never reachable from ~MultiTx()
  and leaked. Now the failure path deletes the tx before returning.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@MarkRose MarkRose closed this Jul 12, 2026
@MarkRose MarkRose reopened this Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant