Close file in case of error

This commit is contained in:
ritt 2021-10-25 13:36:10 +02:00
parent 2e1708b5a3
commit cb3afcd826

View File

@ -1154,6 +1154,7 @@ int main(int argc, char *argv[])
if (size > (INT) (sizeof(text) - 1)) { if (size > (INT) (sizeof(text) - 1)) {
printf("Message file \"%s\" is too long (%zd bytes max).\n", textfile, sizeof(text)); printf("Message file \"%s\" is too long (%zd bytes max).\n", textfile, sizeof(text));
close(fh);
return 1; return 1;
} }
@ -1161,6 +1162,7 @@ int main(int argc, char *argv[])
if (i < size) { if (i < size) {
printf("Cannot fully read message from file %s.\n", textfile); printf("Cannot fully read message from file %s.\n", textfile);
close(fh);
return 1; return 1;
} }