trying to add correct memory allocation
it's possible I'll revert this lol
This commit is contained in:
parent
9a2663c7a4
commit
7f90c74124
@ -33,7 +33,7 @@ outputFlags decryptText(char *text, char *key, inputFlags flags)
|
||||
}
|
||||
|
||||
//SET LENGTH (numberBuffer)
|
||||
returningText = malloc(sizeof(int) * numberBuffer);
|
||||
returningText = malloc(sizeof(char) * numberBuffer);
|
||||
textKeyChain = malloc(sizeof(int) * numberBuffer);
|
||||
int encryptedTextKeyChain[sizeof(int) * numberBuffer];
|
||||
textKeyChainLength = numberBuffer;
|
||||
@ -54,7 +54,7 @@ outputFlags decryptText(char *text, char *key, inputFlags flags)
|
||||
numberBuffer++;
|
||||
}
|
||||
|
||||
textBuffer = malloc(sizeof(int) * numberBuffer);
|
||||
textBuffer = malloc(sizeof(char) * numberBuffer);
|
||||
|
||||
//LOAD textBuffer
|
||||
for (int j = 0; j < strlen(text); j++)
|
||||
|
@ -14,7 +14,7 @@ outputFlags encryptText(char *text, char *keyNew, inputFlags flags)
|
||||
if (!flags.skipCheck) checkVersion(flags);
|
||||
|
||||
//VARIABLES
|
||||
char *key = malloc(sizeof(int) * getKeyLength());
|
||||
char *key = malloc(sizeof(char) * getKeyLength());
|
||||
char *returningText;
|
||||
char *textBuffer;
|
||||
int *textKeyChain = malloc(sizeof(int) * strlen(text));
|
||||
@ -78,7 +78,7 @@ outputFlags encryptText(char *text, char *keyNew, inputFlags flags)
|
||||
}
|
||||
|
||||
//ALLOCATE returningText (WITH THE SEPARATORS)
|
||||
returningText = malloc(sizeof(int) * numberBuffer + strlen(text) - 1);
|
||||
returningText = malloc(sizeof(char) * numberBuffer + strlen(text) - 1);
|
||||
strcpy(returningText, "");
|
||||
|
||||
//LOAD returningText
|
||||
|
@ -10,7 +10,7 @@ int main(void)
|
||||
|
||||
inputFlags flags =
|
||||
{
|
||||
1, //SKIP CHECK
|
||||
0, //SKIP CHECK
|
||||
0, //NO OUTPUT
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user