]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Make sure split partition files are cleaned up on failure
authorDaan De Meyer <daan.j.demeyer@gmail.com>
Thu, 24 Nov 2022 08:50:04 +0000 (09:50 +0100)
committerDaan De Meyer <daan.j.demeyer@gmail.com>
Tue, 29 Nov 2022 09:08:51 +0000 (10:08 +0100)
src/partition/repart.c

index 860ffdae36e89d0f6e8e53045c6ad04b039472e9..6d94da639f793dc3136c33cbe38698d9830240a1 100644 (file)
@@ -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;
 }