fixed possible memory leaks

This commit is contained in:
Václav Šmejkal 2022-04-26 19:04:43 +02:00
parent 8b822bae1c
commit 827a2a24e2
2 changed files with 9 additions and 1 deletions

View File

@ -15,7 +15,11 @@ decryptText(char *text, char *key)
fprintf(stderr, "Key must be at least %d characters long!\n", KEY_LENGTH); fprintf(stderr, "Key must be at least %d characters long!\n", KEY_LENGTH);
exit(INVALID_KEY); exit(INVALID_KEY);
} }
//REDEFINE KEY_LENGTH
#undef KEY_LENGTH
#define KEY_LENGTH strlen(key)
//VARIABLES //VARIABLES
char *returningText; char *returningText;
int numberBuffer; int numberBuffer;

View File

@ -34,6 +34,10 @@ encryptText(char *text, char *keyNew)
strcpy(key, keyNew); strcpy(key, keyNew);
//REDEFINE KEY_LENGTH
/*#undef KEY_LENGTH
#define KEY_LENGTH strlen(key)*/
goto skipKey; goto skipKey;
} }