You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
libobs pulse: get_default_id leaks the sink name when the default sink name is empty #158
if (!pdo->default_sink_name|| !*pdo->default_sink_name) {
*id=bzalloc(1); // empty-string case: pdo->default_sink_name is never freed
} else {
...
bfree(pdo->default_sink_name);
}
When PulseAudio/PipeWire reports an empty default sink name, the bstrdup copy made in pulseaudio_default_devices leaks. That happens with no sinks, a headless or CI box, or a null sink being removed. devices_match() calls this from obs_source_audio_output_capture_device_changed on source creation and on every device change. Each call also does a blocking round-trip to the sound server.
It came to light while triaging the TSan pass, whose reports from this path were in uninstrumented libpulse and were dismissed as false positives.
Fix
Call bfree(pdo->default_sink_name) unconditionally (it's NULL-safe) after building *id.
Claiming: #158. Plan: free default_sink_name on both branches of get_default_id, with a cmocka test (RED first) if the pulse wrapper can be driven without a sound server; otherwise a characterization of the leak through a stubbed pulseaudio_get_server_info. One PR.
Activity
zackees commentedon Oct 13, 2026
Claiming: #158. Plan: free
default_sink_nameon both branches ofget_default_id, with a cmocka test (RED first) if the pulse wrapper can be driven without a sound server; otherwise a characterization of the leak through a stubbedpulseaudio_get_server_info. One PR.test: Format test_pulse_default_id.c
test: Check that get_default_id frees an empty default sink name (RED)
libobs: Free an empty default sink name in get_default_id (GREEN)