replaced all memset with calloc

This commit is contained in:
Václav Šmejkal 2023-01-26 12:59:30 +01:00
parent 44bc62c73b
commit c75c4fd84b
Signed by: ENGO150
GPG Key ID: F6D6DF86242C5A59
2 changed files with 2 additions and 8 deletions

View File

@ -75,7 +75,7 @@ outputFlags decryptText(char *text, char *keyNew)
}
//SET LENGTH (numberBuffer)
returningText = malloc(numberBuffer + 1);
returningText = calloc(numberBuffer + 1, sizeof(char));
textKeyChain = malloc(sizeof(int) * numberBuffer);
encryptedTextKeyChain = malloc(sizeof(int) * numberBuffer);
textKeyChainLength = numberBuffer;
@ -124,9 +124,6 @@ outputFlags decryptText(char *text, char *keyNew)
textKeyChain[i] = getEncryptionOperation()(textKeyChain[i], encryptedTextKeyChain[i]);
}
//FIX (CLEAN) returningText
memset(returningText, '\0', textKeyChainLength + 1);
//LOAD returningText
for (int i = 0; i < textKeyChainLength; i++)
{

View File

@ -137,10 +137,7 @@ boolean checkVersion(void)
rewind(fileBuffer); //REWIND fileBuffer (NO SHIT)
//SET LENGTH OF buffer
buffer = malloc(bufferSize + 1);
//FIX buffer
memset(buffer, '\0', bufferSize);
buffer = calloc(bufferSize + 1, sizeof(char));
//LOAD jsonFile
(void) (fread(buffer, bufferSize, 1, fileBuffer) + 1); //TODO: Try to create some function for processing exit value