diff --git a/source3/lib/replace/getpass.c b/source3/lib/replace/getpass.c index 57e28eb9815..73333b90219 100644 --- a/source3/lib/replace/getpass.c +++ b/source3/lib/replace/getpass.c @@ -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; } }