Skip to content

test: Free the background hotkey state in test_portal_shortcuts - #465

Merged
zackees merged 1 commit into
masterfrom
fix/464-portal-shortcuts-leak
Oct 13, 2026
Merged

zackees merged 1 commit into
masterfrom
fix/464-portal-shortcuts-leak

Conversation

@zackees

@zackees zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member

Closes #464.

LeakSanitizer and valgrind reported 2496 bytes in 46 allocations from test_portal_shortcuts: the background shortcuts darray (set_shortcuts), each shortcut's trigger string (set_triggers), and the error string (set_state). OBS doesn't leak here. obs_free_hotkeys() in obs.c frees all three at shutdown. The test runs the portal code against its own obs_core (-Dobs=hotkey_test_obs), doesn't build obs.c, and tore down with obs_hotkeys_free() only.

The teardown now does the same obs_hotkeys_background_clear_shortcuts + da_free + bfree(error).

Verification:

The test runs the portal code against its own obs_core and tore it down
with obs_hotkeys_free() only. The background shortcuts, their trigger
strings and the error string are freed by obs_free_hotkeys() in obs.c,
which the test doesn't build, so LeakSanitizer and valgrind reported
them as leaks. The teardown now frees them the same way. OBS itself
doesn't leak here.

Closes #464

Local-Gate: v1 tree=01d301cb202c536c05372d2a4238d210af483776 secs=259 lanes=lint:run,rust-test:run,tier2-linux:run
Ci-Attestation: {"at":1791871748,"gate":"rust/all/fmt","host":"linux-x86_64","key":"558664c5766ec795d0017c4acdd11ff4b9d5d700dbe93c18089a28dd6abc5ef3","lane":"lint","parents":["1c3961ae138b65e4690a1b9396f713f68db9e7cc"],"secs":31,"stamp":"22ea443ee33f75e9c03b840abdb44170","tree":"01d301cb202c536c05372d2a4238d210af483776","v":1,"via":"run"}
Ci-Attestation: {"at":1791871748,"gate":"rust/x86_64-unknown-linux-gnu/clippy","host":"linux-x86_64","key":"558664c5766ec795d0017c4acdd11ff4b9d5d700dbe93c18089a28dd6abc5ef3","lane":"lint","parents":["1c3961ae138b65e4690a1b9396f713f68db9e7cc"],"secs":31,"stamp":"0b0a088382041ca07a701708a6ee16d6","tree":"01d301cb202c536c05372d2a4238d210af483776","v":1,"via":"run"}
Ci-Attestation: {"at":1791871748,"gate":"rust/x86_64-unknown-linux-gnu/test","host":"linux-x86_64","key":"51cbacbd95cdb02e3d6e835517bc820ed41ac874d30ab14dc5e657516b067b91","lane":"rust-test","parents":["1c3961ae138b65e4690a1b9396f713f68db9e7cc"],"secs":135,"stamp":"941349dc19efcd11c71981d425044eba","tree":"01d301cb202c536c05372d2a4238d210af483776","v":1,"via":"run"}
Ci-Attestation: {"at":1791871748,"gate":"cpp/linux-x64/tier2","host":"linux-x86_64","key":"169437838bf117b757c0040ead323eb1a8ba15fefce1b482eae116610b101d1b","lane":"tier2-linux","parents":["1c3961ae138b65e4690a1b9396f713f68db9e7cc"],"secs":93,"stamp":"0f556fe25b93db7edfbaf62e7f10e60b","tree":"01d301cb202c536c05372d2a4238d210af483776","v":1,"via":"run"}
@zackees

zackees commented Oct 13, 2026

Copy link
Copy Markdown
Member Author

ASan pass on this branch (run 38355130077): test_portal_shortcuts no longer appears in the findings. It was the 2496-byte leak on master's run 38351762501.

@zackees
zackees merged commit bc01295 into master Oct 13, 2026
20 checks passed
@zackees
zackees deleted the fix/464-portal-shortcuts-leak 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.

bug: libobs: portal shortcuts leak darray storage in set_shortcuts

1 participant