completed deallocation functions

I mean it worked fine, but now it sets strings to null etc.
This commit is contained in:
Václav Šmejkal 2023-01-26 10:26:01 +01:00
parent e2eca1e3ea
commit 4ec8edafcb
Signed by: ENGO150
GPG Key ID: F6D6DF86242C5A59
3 changed files with 12 additions and 0 deletions

View File

@ -315,6 +315,14 @@ void deallocateOutput(outputFlags flags)
{
free(flags.outputText);
free(flags.usedKey);
flags.elapsedTime = 0;
flags.exitCode = SUCCESS;
flags.repeatedKeySize = 0;
flags.unusedKeySize = 0;
flags.outputText = NULL;
flags.usedKey = NULL;
}
boolean checkKey(char *key)

View File

@ -77,5 +77,6 @@ int main(void)
free(usedKey);
deallocateLogger(logger);
deallocateDecryptedOutput(decrypted);
return exitCode;
}

View File

@ -33,6 +33,9 @@ void deallocateLogger(logFile logger)
{
close(logger.file);
free(logger.fileName);
logger.fileName = NULL;
logger.file = INVALID_FILE;
}
void deallocateDecryptedOutput(decryptedOutput output)