diff --git a/src/partition/repart.c b/src/partition/repart.c index 9325b32100..773874021d 100644 --- a/src/partition/repart.c +++ b/src/partition/repart.c @@ -4398,11 +4398,9 @@ static int add_subvolume_path(const char *path, Set **subvolumes) { if (r < 0) return log_error_errno(r, "Failed to stat source file '%s/%s': %m", strempty(arg_root), path); - r = set_ensure_put(subvolumes, &inode_hash_ops, st); + r = set_ensure_consume(subvolumes, &inode_hash_ops, TAKE_PTR(st)); if (r < 0) return log_oom(); - if (r > 0) - TAKE_PTR(st); return 0; } diff --git a/src/shared/bootspec.c b/src/shared/bootspec.c index d23eab38df..42d5fec754 100644 --- a/src/shared/bootspec.c +++ b/src/shared/bootspec.c @@ -576,13 +576,14 @@ static int config_check_inode_relevant_and_unseen(BootConfig *config, int fd, co log_debug("Inode '%s' already seen before, ignoring.", fname); return false; } + d = memdup(&st, sizeof(st)); if (!d) return log_oom(); - if (set_ensure_put(&config->inodes_seen, &inode_hash_ops, d) < 0) + + if (set_ensure_consume(&config->inodes_seen, &inode_hash_ops, TAKE_PTR(d)) < 0) return log_oom(); - TAKE_PTR(d); return true; }