VeraCrypt
aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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
@@ -128,9 +128,11 @@ 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;
while (kf != NULL)