1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-11-11 12:24:29 +03:00

dissect-image: take reference of DecryptedImage into DissectedImage

No functional changes. Preparation for later commits.
This commit is contained in:
Yu Watanabe
2022-09-11 23:08:25 +09:00
parent 9321ad5118
commit ac1e1b5fd7
2 changed files with 11 additions and 2 deletions

View File

@@ -1112,9 +1112,14 @@ DissectedImage* dissected_image_unref(DissectedImage *m) {
if (!m)
return NULL;
/* First, clear dissected partitions. */
for (PartitionDesignator i = 0; i < _PARTITION_DESIGNATOR_MAX; i++)
dissected_partition_done(m->partitions + i);
/* Second, free decrypted images. This must be after dissected_partition_done(), as freeing
* DecryptedImage may try to deactivate partitions. */
decrypted_image_unref(m->decrypted_image);
free(m->image_name);
free(m->hostname);
strv_free(m->machine_info);
@@ -2096,7 +2101,8 @@ int dissected_image_decrypt(
return -EINVAL;
if (!m->encrypted && !m->verity_ready) {
*ret = NULL;
if (ret)
*ret = NULL;
return 0;
}
@@ -2130,7 +2136,9 @@ int dissected_image_decrypt(
}
}
*ret = TAKE_PTR(d);
m->decrypted_image = TAKE_PTR(d);
if (ret)
*ret = decrypted_image_ref(m->decrypted_image);
return 1;
#else

View File

@@ -211,6 +211,7 @@ struct DissectedImage {
bool single_file_system:1; /* MBR/GPT or single file system */
DissectedPartition partitions[_PARTITION_DESIGNATOR_MAX];
DecryptedImage *decrypted_image;
/* Meta information extracted from /etc/os-release and similar */
char *image_name;