Fix memory leak in LUKS2 requirements handling for restore context.

This commit is contained in:
Milan Broz
2017-10-28 12:01:02 +02:00
parent 6e3622e0f1
commit 31779c0763

View File

@@ -1019,14 +1019,15 @@ int LUKS2_hdr_restore(struct crypt_device *cd, struct luks2_hdr *hdr,
if (r < 0) {
log_err(cd, _("Backup file doesn't contain valid LUKS header.\n"));
return r;
goto out;
}
/* do not allow header restore from backup with unmet requirements */
if (LUKS2_unmet_requirements(cd, &hdr_file, 0, 1)) {
log_err(cd, _("Unmet LUKS2 requirements detected in backup %s.\n"),
backup_file);
return -ETXTBSY;
r = -ETXTBSY;
goto out;
}
buffer_size = LUKS2_hdr_and_areas_size(hdr_file.jobj);