mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-16 21:29:59 +01:00
Fix memory leaks detected in compat-test-opal.
This commit is contained in:
@@ -471,6 +471,8 @@ int opal_setup_ranges(struct crypt_device *cd,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
crypt_safe_free(user_session);
|
||||||
|
|
||||||
user_session = crypt_safe_alloc(sizeof(struct opal_session_info));
|
user_session = crypt_safe_alloc(sizeof(struct opal_session_info));
|
||||||
if (!user_session) {
|
if (!user_session) {
|
||||||
r = -ENOMEM;
|
r = -ENOMEM;
|
||||||
|
|||||||
@@ -2896,14 +2896,15 @@ static int opal_erase(struct crypt_device *cd, bool factory_reset) {
|
|||||||
if (factory_reset && !ARG_SET(OPT_BATCH_MODE_ID) &&
|
if (factory_reset && !ARG_SET(OPT_BATCH_MODE_ID) &&
|
||||||
!yesDialog(_("WARNING: WHOLE disk will be factory reset and all data will be lost! Continue?"),
|
!yesDialog(_("WARNING: WHOLE disk will be factory reset and all data will be lost! Continue?"),
|
||||||
_("Operation aborted.\n"))) {
|
_("Operation aborted.\n"))) {
|
||||||
|
crypt_safe_free(password);
|
||||||
return -EPERM;
|
return -EPERM;
|
||||||
}
|
}
|
||||||
|
|
||||||
return crypt_wipe_hw_opal(cd,
|
r = crypt_wipe_hw_opal(cd, factory_reset ? CRYPT_NO_SEGMENT : CRYPT_LUKS2_SEGMENT,
|
||||||
factory_reset ? CRYPT_NO_SEGMENT : CRYPT_LUKS2_SEGMENT,
|
password, password_size, 0);
|
||||||
password,
|
|
||||||
password_size,
|
crypt_safe_free(password);
|
||||||
0);
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int action_luksErase(void)
|
static int action_luksErase(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user