mirror of
https://git.disroot.org/80486DX2-66/polonium.git
synced 2024-12-27 07:30:23 +05:30
main.c: close the file on abort and errors
This commit is contained in:
parent
6776f0e989
commit
7f6a63232f
@ -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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user