mirror of
https://github.com/morgan9e/systemd
synced 2026-04-14 08:25:20 +09:00
sd-device-enumerator: use _cleanup_free_ attribute for safety
No functional changes, just improve readability. Suggested by https://github.com/systemd/systemd/pull/24601#discussion_r966883459.
This commit is contained in:
@@ -935,13 +935,17 @@ static int enumerator_scan_devices_children(sd_device_enumerator *enumerator) {
|
||||
r = k;
|
||||
}
|
||||
|
||||
for (char *p; (p = set_steal_first(stack)); free(p)) {
|
||||
for (;;) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
p = set_steal_first(stack);
|
||||
if (!p)
|
||||
return r;
|
||||
|
||||
k = parent_crawl_children(enumerator, p, &stack);
|
||||
if (k < 0)
|
||||
r = k;
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
static int enumerator_scan_devices_all(sd_device_enumerator *enumerator) {
|
||||
|
||||
Reference in New Issue
Block a user