fix: remove some free
This commit is contained in:
@@ -643,8 +643,6 @@ const char *ChaCha20_DRBG_Generate_algorithm(uint8_t *V, uint8_t *Key,
|
||||
|
||||
(*reseed_counter)++;
|
||||
|
||||
free(additional_input);
|
||||
free(temp);
|
||||
return "Success";
|
||||
}
|
||||
|
||||
@@ -755,18 +753,19 @@ int main() {
|
||||
|
||||
// 需要生成的比特串长度
|
||||
printf("Enter the length of the bit string to be generated(bit): ");
|
||||
scanf("%ld", &returned_bits_len);
|
||||
// returned_bits_len = 128;
|
||||
// scanf("%ld", &returned_bits_len);
|
||||
returned_bits_len = 128;
|
||||
|
||||
// 需要生成的比特串个数
|
||||
printf("Enter the number of the bit string to be generated: ");
|
||||
scanf("%ld", &returned_bits_num);
|
||||
// returned_bits_num = 1000;
|
||||
// scanf("%ld", &returned_bits_num);
|
||||
returned_bits_num = 1000;
|
||||
|
||||
// char *filename; filename 未分配内存
|
||||
char filename[100]; // 假设文件名长度不超过 99 个字符
|
||||
printf("Enter the name of the saved file: ");
|
||||
scanf("%s", filename);
|
||||
// scanf("%s", filename);
|
||||
strcpy(filename, "1.txt");
|
||||
|
||||
// 生成的比特串保存在文本文件中
|
||||
FILE *file = fopen(filename, "w");
|
||||
@@ -826,6 +825,5 @@ int main() {
|
||||
|
||||
fclose(file);
|
||||
|
||||
free(returned_bits);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user