VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMounir IDRASSI <mounir.idrassi@idrix.fr>2016-10-08 20:20:32 +0200
committerMounir IDRASSI <mounir.idrassi@idrix.fr>2016-10-17 18:17:50 +0200
commitf6541e76e09b888884830f19dae47e4004c6df62 (patch)
treea90cbf767c2b637c9f96f0885dfe715622d5078b
parent012c9134d4f6e29c2e13e56490e47a8547d41af7 (diff)
downloadVeraCrypt-DCS-f6541e76e09b888884830f19dae47e4004c6df62.tar.gz
VeraCrypt-DCS-f6541e76e09b888884830f19dae47e4004c6df62.zip
Correctly reset SecRegionData and SecRegionSize variables in case of error
-rw-r--r--DcsCfg/DcsCfgCrypt.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/DcsCfg/DcsCfgCrypt.c b/DcsCfg/DcsCfgCrypt.c
index 7295756..a5b0d6c 100644
--- a/DcsCfg/DcsCfgCrypt.c
+++ b/DcsCfg/DcsCfgCrypt.c
@@ -737,6 +737,7 @@ OSBackupKeyLoad(
if (EFI_ERROR(res) || SecRegionSize < 512) {
SecRegionSize = 0;
MEM_FREE(SecRegionData);
+ SecRegionData = NULL;
}
if (SecRegionSize == 0) {
res = PlatformGetAuthData(&SecRegionData, &SecRegionSize, &SecRegionHandle);
@@ -757,6 +758,7 @@ OSBackupKeyLoad(
SecRegionOffset += 128 * 1024;
if (SecRegionOffset > SecRegionSize) {
MEM_FREE(SecRegionData);
+ SecRegionData = NULL;
SecRegionOffset = 0;
res = PlatformGetAuthData(&SecRegionData, &SecRegionSize, &SecRegionHandle);
if (EFI_ERROR(res)) {
@@ -819,6 +821,8 @@ OSBackupKeyLoad(
error:
MEM_FREE(SecRegionData);
+ SecRegionData = NULL;
+ SecRegionSize = 0;
return res;
}
@@ -847,6 +851,8 @@ OSRestoreKey()
error:
MEM_FREE(SecRegionData);
+ SecRegionData = NULL;
+ SecRegionSize = 0;
return res;
}