From 7b5f1ba9b6ec9b290053433059216e6269c40ad2 Mon Sep 17 00:00:00 2001 From: ENGO150 Date: Sun, 8 May 2022 19:54:46 +0200 Subject: [PATCH] created function for deallocating outputFlags --- include/misc.h | 1 + src/lib/misc.c | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/include/misc.h b/include/misc.h index acc29bb..03f6cfb 100644 --- a/include/misc.h +++ b/include/misc.h @@ -5,6 +5,7 @@ void checkVersion(inputFlags flags); //THIS FUNCTION CHECKS IF LATEST VERSION OF WHY2 IS USED void generateTextKeyChain(char key[], int *textKeyChain, int textKeyChainSize); //GENERATES ARRAY FOR ENCRYPTION/DECRYPTION +void deallocateOutput(outputFlags flags); //DEALLOCATES flags int countIntLength(int number); //RETURNS LENGTH OF number #endif diff --git a/src/lib/misc.c b/src/lib/misc.c index 96daf88..b2d0157 100644 --- a/src/lib/misc.c +++ b/src/lib/misc.c @@ -88,8 +88,7 @@ void checkVersion(inputFlags flags) } } -void -generateTextKeyChain(char key[], int *textKeyChain, int textKeyChainSize) +void generateTextKeyChain(char key[], int *textKeyChain, int textKeyChainSize) { int numberBuffer; @@ -117,8 +116,13 @@ generateTextKeyChain(char key[], int *textKeyChain, int textKeyChainSize) } } -int -countIntLength(int number) +void deallocateOutput(outputFlags flags) +{ + free(flags.outputText); + free(flags.usedKey); +} + +int countIntLength(int number) { int returning = 1; int buffer = 10;