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;