Fix Coverity ID 554
authorVolker Lendecke <vl@samba.org>
Sat, 15 Mar 2008 21:27:05 +0000 (22:27 +0100)
committerStefan Metzmacher <metze@samba.org>
Tue, 18 Mar 2008 15:40:46 +0000 (16:40 +0100)
(cherry picked from commit 471b1b0c58bc2def5d2fe9d98401def34724d447)
(This used to be commit effda48a2670325fed56e158539417c6f95381b8)

source4/lib/replace/getpass.c

index 57e28eb981577594c2d8b6a0511fe2a21157f9ec..73333b902199b92d6627f2c1794124ebf7922ce8 100644 (file)
@@ -187,6 +187,9 @@ char *rep_getpass(const char *prompt)
                in_fd = fileno(in);
                if (fgets(buf, bufsize, in) == NULL) {
                        buf[0] = 0;
+                       if (in && in != stdin) {
+                               fclose(in);
+                       }
                        return buf;
                }
        }