if (r < 0)
return r;
+ search_domains = ordered_set_new(&string_hash_ops_free);
+ if (!search_domains)
+ return -ENOMEM;
+
+ route_domains = ordered_set_new(&string_hash_ops_free);
+ if (!route_domains)
+ return -ENOMEM;
+
for (;;) {
_cleanup_free_ char *str = NULL;
- OrderedSet **domains;
const char *name;
int route_only;
if (r < 0)
return sd_bus_error_setf(error, SD_BUS_ERROR_INVALID_ARGS, "Invalid search domain %s", name);
- domains = route_only ? &route_domains : &search_domains;
- r = ordered_set_ensure_allocated(domains, &string_hash_ops_free);
- if (r < 0)
- return r;
-
- r = ordered_set_consume(*domains, TAKE_PTR(str));
+ r = ordered_set_consume(route_only ? route_domains : search_domains, TAKE_PTR(str));
if (r == -EEXIST)
continue;
if (r < 0)