1
0
mirror of https://git.disroot.org/80486DX2-66/polonium.git synced 2024-12-26 15:10:40 +05:30

main.c: close the file on abort and errors

This commit is contained in:
Intel A80486DX2-66 2024-11-18 18:49:30 +03:00
parent 6776f0e989
commit 7f6a63232f
Signed by: 80486DX2-66
GPG Key ID: 83631EF27054609B

View File

@ -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;
}