]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: don't unload data we configured explicitly, and fully free all data we match...
authorLennart Poettering <lennart@poettering.net>
Tue, 11 Aug 2020 12:50:36 +0000 (14:50 +0200)
committerLennart Poettering <lennart@poettering.net>
Mon, 24 Aug 2020 19:58:53 +0000 (21:58 +0200)
The context_unload_partition_table() call is supposed to remove all
data from the loaded partitions about how we mapped it to existing
partitions on disk, but it should leave everything we parsed from the
definition files in place.

We mostly got this right, except for two cases:

1. new_uuid is parsed from the definition files and should stay

2. current_label is read from the existing partition table and should be
   freed

src/partition/repart.c

index 572db3bdc4068e276cec4ff8b86921d1e04b36d8..4768600a8dca0770bc3a45ab43ffa6973e695fe4 100644 (file)
@@ -1563,7 +1563,8 @@ static void context_unload_partition_table(Context *context) {
                 p->padding_area = NULL;
                 p->allocated_to_area = NULL;
 
-                p->current_uuid = p->new_uuid = SD_ID128_NULL;
+                p->current_uuid = SD_ID128_NULL;
+                p->current_label = mfree(p->current_label);
         }
 
         context->start = UINT64_MAX;