repart: split out that disarms automatic artifact removal

This commit is contained in:
Lennart Poettering
2025-10-22 22:56:01 +02:00
parent aa47d8ade1
commit 78c017a8ed
+11 -4
View File
@@ -855,6 +855,16 @@ static Context* context_free(Context *context) {
DEFINE_TRIVIAL_CLEANUP_FUNC(Context*, context_free);
static void context_disarm_auto_removal(Context *context) {
assert(context);
/* Make sure automatic removal of half-written artifacts is disarmed */
context->node = mfree(context->node);
LIST_FOREACH(partitions, p, context->partitions)
p->split_path = mfree(p->split_path);
}
static int context_add_free_area(
Context *context,
uint64_t size,
@@ -10177,10 +10187,7 @@ static int run(int argc, char *argv[]) {
(void) context_dump(context, /*late=*/ true);
context->node = mfree(context->node);
LIST_FOREACH(partitions, p, context->partitions)
p->split_path = mfree(p->split_path);
context_disarm_auto_removal(context);
return 0;
}