repart: refuse multiple requests with subscribe mode

Otherwise, that triggers memory leak and double free.
This commit is contained in:
Yu Watanabe
2026-08-19 03:29:26 +09:00
parent 112e4fe00a
commit b52f89e53b
@@ -169,6 +169,10 @@ int vl_method_list_candidate_devices(
_cleanup_(list_candidate_devices_context_freep) ListCandidateDevicesContext *c = NULL;
if (p.subscribe) {
/* Refuse multiple requests per connection. */
if (sd_varlink_get_userdata(link))
return -EBUSY;
/* Start the monitor *before* the initial enumeration so we don't lose events that fire
* during the enumeration window. Duplicate add events for the same device are
* legitimate and documented; clients upsert by identifier. */