diff --git a/src/main.c b/src/main.c index 689eee8..db95a28 100644 --- a/src/main.c +++ b/src/main.c @@ -376,6 +376,9 @@ int main(int argc, char** argv) { if (tolower(character) != 'y') { printf("File corruption aborted.\n"); + + fclose(file); + return EXIT_FAILURE; } } @@ -402,11 +405,15 @@ int main(int argc, char** argv) { if (result == NULL) { PERROR_MACRO("corrupt_file memory allocation"); + fclose(file); + return EXIT_FAILURE; } else if (result->error) { - free(result); PERROR_MACRO("corrupt_file"); + free(result); + fclose(file); + return EXIT_FAILURE; }