fixed possible memory leaking issue

This commit is contained in:
Václav Šmejkal 2022-03-13 15:24:21 +01:00
parent 76b8230cb2
commit 25d11590b8

View File

@ -102,7 +102,7 @@ encryptText(char *text, char *keyNew)
//LOAD returningText //LOAD returningText
for (int i = 0; i < (sizeof(textKeyChain) / sizeof(int)); i++) for (int i = 0; i < (sizeof(textKeyChain) / sizeof(int)); i++)
{ {
textBuffer = malloc(10); textBuffer = malloc(floor(log10(abs(textKeyChain[i]))));
sprintf(textBuffer, "%d", textKeyChain[i]); sprintf(textBuffer, "%d", textKeyChain[i]);