From: Thomas Cort Date: Sun, 7 Feb 2016 13:18:01 +0000 (+0000) Subject: mail: close `fp` after use X-Git-Url: http://zhaoyanbai.com/repos/%22/xml/v3/tasks/static/gitweb.js?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F3292%2F1;p=minix.git mail: close `fp` after use Add missing `fclose(fp)` Issue #109 Change-Id: I0908ede77cba18336c399c5e16771cb6650e6404 --- 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)