From cb3afcd826d26bfb58e9095bf8bb4f79815a8127 Mon Sep 17 00:00:00 2001 From: ritt Date: Mon, 25 Oct 2021 13:36:10 +0200 Subject: [PATCH] Close file in case of error --- src/elog.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/elog.c b/src/elog.c index 51b721e5..aa028cb6 100755 --- a/src/elog.c +++ b/src/elog.c @@ -1154,6 +1154,7 @@ int main(int argc, char *argv[]) if (size > (INT) (sizeof(text) - 1)) { printf("Message file \"%s\" is too long (%zd bytes max).\n", textfile, sizeof(text)); + close(fh); return 1; } @@ -1161,6 +1162,7 @@ int main(int argc, char *argv[]) if (i < size) { printf("Cannot fully read message from file %s.\n", textfile); + close(fh); return 1; }