Skip to content

Fix xref cleanup ordering and purge - #26473

Merged
trufae merged 1 commit into
radareorg:masterfrom
0verflowme:codex/fix-anal-xrefs-lifecycle
Aug 15, 2026
Merged

Fix xref cleanup ordering and purge#26473
trufae merged 1 commit into
radareorg:masterfrom
0verflowme:codex/fix-anal-xrefs-lifecycle

Conversation

@0verflowme

Copy link
Copy Markdown
Member

Summary

  • free the xref manager before destroying the analysis lock
  • reset xrefs when purging an analysis context
  • verify purge clears old references and leaves the manager reusable

Root cause

r_anal_free() destroyed anal->lock before calling r_anal_xrefs_free(), even though xref cleanup acquires that lock. This could access a destroyed mutex during teardown.

r_anal_purge() reset functions, metadata, types, and imports but retained the old xref manager, allowing references from the previous analysis to survive into the next one.

Validation

  • clean build from current upstream master
  • test_anal_xrefs: 2/2 passing
  • git diff --check

Free the xref manager before destroying the analysis lock to avoid using a destroyed mutex during teardown. Reinitialize the manager during purge so references from the previous analysis cannot survive into the next one.
@0verflowme
0verflowme marked this pull request as ready for review August 15, 2026 12:19
@trufae
trufae merged commit 6b32cbb into radareorg:master Aug 15, 2026
52 checks passed
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.

2 participants