Skip to content

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

Closed

Description

@zackees

ASan (run 40061643300, test_xcomposite_window_events) reports 36-byte leaks at:

  • xcomp_window_exists (xcomposite-input.c.h:78)
  • xcomp_create_pixmap (:339)
  • xcb_xcursor_offset_win (xcursor-xcb.c.h:129)

When a request fails (for example, the window is gone), xcb returns a malloc'd xcb_generic_error_t that the caller must free, and none of the three frees it. xcomp_window_exists runs on the safety-net round trip of every capture source, so a capture whose window has closed leaks one error each time it checks.

Fix: free the error in all three. Test: a new cmocka test calls the functions on a nonexistent window 1000 times and checks that the heap doesn't grow (mallinfo2).

Activity

  1. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Claiming: RED cmocka test + free the xcb errors. PR today.

  2. added
    claimed
    on Oct 24, 2026
  3. zackees commented on Oct 24, 2026

    @zackees
    MemberAuthor

    Fixed by #2054 (merged). All five xcb error-reply sites in the XComposite capture now free their error. test_xcomposite_error_replies covers xcomp_window_exists and xcb_xcursor_offset_win; it failed with about 48 KB of growth per 1000 calls before the fix.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    claimed

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions