style. we use calloc

This commit is contained in:
iceman1001 2024-01-07 20:47:07 +01:00
commit 482a6464a2
6 changed files with 7 additions and 7 deletions

View file

@ -452,7 +452,7 @@ int main(int argc, char *argv[]) {
void *status;
// make the table of tables
t = (struct table *)malloc(sizeof(struct table) * 65536);
t = (struct table *)calloc(sizeof(struct table) * 65536, sizeof(uint8_t));
if (!t) {
printf("malloc failed\n");
exit(1);

View file

@ -196,7 +196,7 @@ static void *crack(void *d) {
numnrar = data->numnrar;
// create space for tables
Tk = (struct Tklower *)malloc(sizeof(struct Tklower) * 0x40000);
Tk = (struct Tklower *)calloc(sizeof(struct Tklower) * 0x40000, sizeof(uint8_t));
if (!Tk) {
printf("Failed to allocate memory (Tk)\n");
exit(1);
@ -314,7 +314,7 @@ int main(int argc, char *argv[]) {
}
// create table of nR aR pairs
TnRaR = (struct nRaR *)malloc(sizeof(struct nRaR) * NUM_NRAR);
TnRaR = (struct nRaR *)calloc(sizeof(struct nRaR) * NUM_NRAR, sizeof(uint8_t));
// open file
fp = fopen(argv[2], "r");