summaryrefslogtreecommitdiffstats
path: root/src/partition
diff options
context:
space:
mode:
authorDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-24 09:50:04 +0100
committerDaan De Meyer <daan.j.demeyer@gmail.com>2022-11-29 10:08:51 +0100
commita2d7c42e97815fdca21b8ce633c5c940d17ad33f (patch)
tree756e16cd703da07f0c55dbb5547b99a49c07b609 /src/partition
parentrepart: Refactor split names (diff)
downloadsystemd-a2d7c42e97815fdca21b8ce633c5c940d17ad33f.tar.xz
systemd-a2d7c42e97815fdca21b8ce633c5c940d17ad33f.zip
repart: Make sure split partition files are cleaned up on failure
Diffstat (limited to 'src/partition')
-rw-r--r--src/partition/repart.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/partition/repart.c b/src/partition/repart.c
index 860ffdae36..6d94da639f 100644
--- a/src/partition/repart.c
+++ b/src/partition/repart.c
@@ -355,7 +355,7 @@ static Partition* partition_free(Partition *p) {
free(p->roothash);
free(p->split_name_format);
- free(p->split_path);
+ unlink_and_free(p->split_path);
return mfree(p);
}
@@ -6495,6 +6495,9 @@ static int run(int argc, char *argv[]) {
(void) context_dump(context, node, /*late=*/ true);
+ LIST_FOREACH(partitions, p, context->partitions)
+ p->split_path = mfree(p->split_path);
+
return 0;
}