Skip to content

fix(linux-capture): free the xcb error reply of failed X requests - #2054

Merged
zackees merged 2 commits into
masterfrom
fix/xcomposite-xcb-reply-leaks
Oct 24, 2026
Merged

zackees merged 2 commits into
masterfrom
fix/xcomposite-xcb-reply-leaks

Conversation

@zackees

@zackees zackees commented Oct 24, 2026

Copy link
Copy Markdown
Member

Fixes #2053

When an X request fails (for example, the window is gone), xcb returns a malloc'd xcb_generic_error_t that the caller must free. This PR frees it at all five places in the XComposite capture that receive one: xcomp_window_exists (the per-source safety-net round trip), xcomp_property_sync, xcomp_top_level_windows, xcomp_create_pixmap (which now also frees its geometry reply) and xcb_xcursor_offset_win. ASan flagged three of them in run 40061643300; I found the other two by checking every place the plugin collects an xcb error.

  • RED (first commit): the new test_xcomposite_error_replies queries a nonexistent window 1000 times. In local ./unittest the heap grows by 48064 and 48000 bytes, against a limit of 8000, so both cases fail.
  • GREEN: the frees. PR CI runs the test under Xvfb. ./lint passes.

Tier 2 only: the linux-capture plugin has no Rust port.

@zackees
zackees enabled auto-merge October 24, 2026 05:12
@zackees
zackees added this pull request to the merge queue Oct 24, 2026
Merged via the queue into master with commit d5960ea Oct 24, 2026
31 checks passed
chriscoveries pushed a commit to chriscoveries/obsrust-fork that referenced this pull request Oct 24, 2026
…ust#2060)

test_obs_scripting_lua_host_macos and test_obs_scripting_python_host_macos
both create and remove ../PlugIns next to the test binaries. ctest runs
them in parallel, so one removes the folder while the other checks it, and
test_dirs fails with 0 != 1 (merge groups for obs-rust#2048 and obs-rust#2054, 2026-10-24).
A shared RESOURCE_LOCK keeps them from running at the same time.
@zackees
zackees deleted the fix/xcomposite-xcb-reply-leaks branch October 26, 2026 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

linux-capture: XComposite capture leaks an xcb error reply on every failed request

1 participant