VeraCrypt
aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/Common/Keyfiles.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/Common/Keyfiles.c b/src/Common/Keyfiles.c
index c634efaf..366d65ee 100644
--- a/src/Common/Keyfiles.c
+++ b/src/Common/Keyfiles.c
@@ -129,7 +129,9 @@ void KeyFileCloneAll (KeyFile *firstKeyFile, KeyFile **outputKeyFile)
KeyFile *cloneFirstKeyFile = KeyFileClone (firstKeyFile);
KeyFile *kf;
- KeyFileRemoveAll (outputKeyFile);
+ // free output only if different from input
+ if (*outputKeyFile != firstKeyFile)
+ KeyFileRemoveAll (outputKeyFile);
if (firstKeyFile)
{
kf = firstKeyFile->Next;