lightningd: parent watchman's formatted blockhash strings to tmpctx - #9363
Open
ksedgwic wants to merge 1 commit into
Open
lightningd: parent watchman's formatted blockhash strings to tmpctx#9363ksedgwic wants to merge 1 commit into
ksedgwic wants to merge 1 commit into
Conversation
json_add_string copies its value, so the strings fmt_bitcoin_blkid allocates in json_block_processed and json_getwatchmanheight are referenced by nothing once the call returns. They are parented to the response stream and freed with it, but the memleak scanner works by searching memory for pointers to each allocation: when a dev memleak check races an in-flight response, the unreferenced string is reported as a leak and fails the test run (seen in a liquid CI run of test_bwatch_add_watch_creates_datastore_entry). Parent them to tmpctx, the idiom used elsewhere. Fixes: ElementsProject#9362 Changelog-None
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.
Fixes #9362 : the memleak scanner can flag the blockhash strings
watchman formats into its RPC responses -- json_add_string copies the
value, so nothing references the string afterward, and a dev memleak
check racing an in-flight response reports it as a leak. Parent them
to tmpctx, the idiom used elsewhere.
Changelog-None