summaryrefslogtreecommitdiff
path: root/source3/lib/replace/getpass.c
diff options
context:
space:
mode:
Diffstat (limited to 'source3/lib/replace/getpass.c')
-rw-r--r--source3/lib/replace/getpass.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/source3/lib/replace/getpass.c b/source3/lib/replace/getpass.c
index 57e28eb981..73333b9021 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;
}
}