From c9d6706004cfcf9527f174215a15b4581427596e Mon Sep 17 00:00:00 2001 From: Big Brother Date: Sun, 7 Feb 2016 13:18:01 +0000 Subject: [PATCH] mail: close `fp` after use Add missing `fclose(fp)` Issue #109 --- minix/commands/mail/mail.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/minix/commands/mail/mail.c b/minix/commands/mail/mail.c index 1326ca50c..e9a553fb9 100644 --- a/minix/commands/mail/mail.c +++ b/minix/commands/mail/mail.c @@ -757,11 +757,15 @@ void dohelp() FILE *fp; char buffer[80]; - if ( (fp = fopen(HELPFILE, "r")) == NULL) + if ( (fp = fopen(HELPFILE, "r")) == NULL) { fprintf(stdout, "can't open helpfile %s\n", HELPFILE); - else - while (fgets(buffer, 80, fp)) - fputs(buffer, stdout); + return; + } + + while (fgets(buffer, 80, fp)) + fputs(buffer, stdout); + + fclose(fp); } int filesize(name)