char **error_path) {
_cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL;
- _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL;
_cleanup_(dissected_image_unrefp) DissectedImage *dissected_image = NULL;
_cleanup_(verity_settings_done) VeritySettings verity = VERITY_SETTINGS_DEFAULT;
_cleanup_strv_free_ char **hierarchies = NULL;
NULL,
&verity,
dissect_image_flags,
- &decrypted_image);
+ NULL);
if (r < 0)
return log_debug_errno(r, "Failed to decrypt dissected image: %m");
}
goto finish;
}
- if (decrypted_image) {
- r = decrypted_image_relinquish(decrypted_image);
- if (r < 0) {
- log_debug_errno(r, "Failed to relinquish decrypted image: %m");
- goto finish;
- }
+ r = dissected_image_relinquish(dissected_image);
+ if (r < 0) {
+ log_debug_errno(r, "Failed to relinquish dissected image: %m");
+ goto finish;
}
- loop_device_relinquish(loop_device);
-
} else if (root_directory) {
/* A root directory is specified. Turn its directory into bind mount, if it isn't one yet. */
}
static int action_mount(DissectedImage *m, LoopDevice *d) {
- _cleanup_(decrypted_image_unrefp) DecryptedImage *di = NULL;
int r;
assert(m);
m, NULL,
&arg_verity_settings,
arg_flags,
- &di);
+ NULL);
if (r < 0)
return r;
if (r < 0)
return log_error_errno(r, "Failed to unlock loopback block device: %m");
- if (di) {
- r = decrypted_image_relinquish(di);
- if (r < 0)
- return log_error_errno(r, "Failed to relinquish DM devices: %m");
- }
+ r = dissected_image_relinquish(m);
+ if (r < 0)
+ return log_error_errno(r, "Failed to relinquish DM and loopback block devices: %m");
- loop_device_relinquish(d);
return 0;
}
static int action_copy(DissectedImage *m, LoopDevice *d) {
_cleanup_(umount_and_rmdir_and_freep) char *mounted_dir = NULL;
- _cleanup_(decrypted_image_unrefp) DecryptedImage *di = NULL;
_cleanup_(rmdir_and_freep) char *created_dir = NULL;
_cleanup_free_ char *temp = NULL;
int r;
m, NULL,
&arg_verity_settings,
arg_flags,
- &di);
+ NULL);
if (r < 0)
return r;
if (r < 0)
return log_error_errno(r, "Failed to unlock loopback block device: %m");
- if (di) {
- r = decrypted_image_relinquish(di);
- if (r < 0)
- return log_error_errno(r, "Failed to relinquish DM devices: %m");
- }
-
- loop_device_relinquish(d);
+ r = dissected_image_relinquish(m);
+ if (r < 0)
+ return log_error_errno(r, "Failed to relinquish DM and loopback block devices: %m");
if (arg_action == ACTION_COPY_FROM) {
_cleanup_close_ int source_fd = -1, target_fd = -1;
if (r < 0)
return r;
- if (decrypted_image) {
- r = decrypted_image_relinquish(decrypted_image);
- if (r < 0)
- return log_error_errno(r, "Failed to relinquish DM devices: %m");
- }
-
- loop_device_relinquish(d);
+ r = dissected_image_relinquish(dissected_image);
+ if (r < 0)
+ return log_error_errno(r, "Failed to relinquish DM and loopback block devices: %m");
*ret_directory = TAKE_PTR(created_dir);
*ret_loop_device = TAKE_PTR(d);
const char *required_sysext_scope) {
_cleanup_(loop_device_unrefp) LoopDevice *loop_device = NULL;
- _cleanup_(decrypted_image_unrefp) DecryptedImage *decrypted_image = NULL;
_cleanup_(dissected_image_unrefp) DissectedImage *dissected_image = NULL;
_cleanup_(verity_settings_done) VeritySettings verity = VERITY_SETTINGS_DEFAULT;
DissectImageFlags dissect_image_flags;
NULL,
&verity,
dissect_image_flags,
- &decrypted_image);
+ NULL);
if (r < 0)
return log_debug_errno(r, "Failed to decrypt dissected image: %m");
return log_debug_errno(r, "Failed to compare image %s extension-release metadata with the root's os-release: %m", dissected_image->image_name);
}
- if (decrypted_image) {
- r = decrypted_image_relinquish(decrypted_image);
- if (r < 0)
- return log_debug_errno(r, "Failed to relinquish decrypted image: %m");
- }
-
- loop_device_relinquish(loop_device);
+ r = dissected_image_relinquish(dissected_image);
+ if (r < 0)
+ return log_debug_errno(r, "Failed to relinquish dissected image: %m");
return 0;
}
case IMAGE_BLOCK: {
_cleanup_(dissected_image_unrefp) DissectedImage *m = NULL;
_cleanup_(loop_device_unrefp) LoopDevice *d = NULL;
- _cleanup_(decrypted_image_unrefp) DecryptedImage *di = NULL;
_cleanup_(verity_settings_done) VeritySettings verity_settings = VERITY_SETTINGS_DEFAULT;
DissectImageFlags flags =
DISSECT_IMAGE_READ_ONLY |
m, NULL,
&verity_settings,
flags,
- &di);
+ NULL);
if (r < 0)
return r;
if (r < 0)
return r;
- if (di) {
- r = decrypted_image_relinquish(di);
- if (r < 0)
- return log_error_errno(r, "Failed to relinquish DM devices: %m");
- }
-
- loop_device_relinquish(d);
+ r = dissected_image_relinquish(m);
+ if (r < 0)
+ return log_error_errno(r, "Failed to relinquish DM and loopback block devices: %m");
break;
}
default: