implemented why2_clean_memory in why2_decrypt_logger

finally proccesing all exit values yay
This commit is contained in:
Václav Šmejkal 2023-02-04 18:32:36 +01:00
parent bc4a3421c4
commit 5879c02d77
Signed by: ENGO150
GPG Key ID: 4A57E86482968843

View File

@ -51,6 +51,8 @@ void why2_deallocate_decrypted_output(why2_decrypted_output output)
why2_decrypted_output why2_decrypt_logger(why2_log_file logger) why2_decrypted_output why2_decrypt_logger(why2_log_file logger)
{ {
why2_set_memory_identifier("logger_decryption");
FILE *file = fdopen(logger.file, "r"); FILE *file = fdopen(logger.file, "r");
why2_output_flags outputBuffer; why2_output_flags outputBuffer;
char *rawContent; char *rawContent;
@ -70,7 +72,13 @@ why2_decrypted_output why2_decrypt_logger(why2_log_file logger)
rawContent = why2_calloc(rawContentL + 1, sizeof(char)); //CALLOC WILL BE USED FOR CLEANING AFTER ALLOCATION rawContent = why2_calloc(rawContentL + 1, sizeof(char)); //CALLOC WILL BE USED FOR CLEANING AFTER ALLOCATION
//LOAD rawContent //LOAD rawContent
(void) (fread(rawContent, rawContentL, 1, file) + 1); //TODO: Try to create some function for processing exit value if (fread(rawContent, rawContentL, 1, file) != 1)
{
if (!why2_get_flags().no_output) fprintf(stderr, "Reading file failed!\n");
why2_clean_memory("logger_decryption");
return why2_empty_decrypted_output();
}
for (int i = 0; i < rawContentL; i++) for (int i = 0; i < rawContentL; i++)
{ {
@ -111,6 +119,8 @@ why2_decrypted_output why2_decrypt_logger(why2_log_file logger)
fclose(file); fclose(file);
why2_deallocate_decrypted_output((why2_decrypted_output) { content, lines }); //fuck the system lmao why2_deallocate_decrypted_output((why2_decrypted_output) { content, lines }); //fuck the system lmao
why2_reset_memory_identifier();
return (why2_decrypted_output) return (why2_decrypted_output)
{ {
contentDecrypted, contentDecrypted,