]> granicus.if.org Git - sudo/commitdiff
Fix fd leak when lecture file option is enabled. From Jerry Brown
authorTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 11 Nov 2005 16:22:58 +0000 (16:22 +0000)
committerTodd C. Miller <Todd.Miller@courtesan.com>
Fri, 11 Nov 2005 16:22:58 +0000 (16:22 +0000)
check.c

diff --git a/check.c b/check.c
index 3fb306181d89912fe716df1f3cb227d4200c2e6c..0a4823f0b0c63ff074b2038c8502b9b1d1569aa6 100644 (file)
--- a/check.c
+++ b/check.c
@@ -126,6 +126,7 @@ lecture(status)
     if (def_lecture_file && (fp = fopen(def_lecture_file, "r")) != NULL) {
        while ((nread = fread(buf, sizeof(char), sizeof(buf), fp)) != 0)
            fwrite(buf, nread, 1, stderr);
+       fclose(fp);
     } else {
        (void) fputs("\n\
 We trust you have received the usual lecture from the local System\n\