diff --git a/tgetpass.c b/tgetpass.c index 028e221b5..bc95d21ac 100644 --- a/tgetpass.c +++ b/tgetpass.c @@ -166,8 +166,10 @@ char * tgetpass(prompt, timeout) } /* get the password */ - if (!fgets(buf, sizeof(buf), input)) + if (!fgets(buf, sizeof(buf), input)) { buf[0] = '\0'; + goto cleanup; + } if (*(tmp = &buf[strlen(buf)-1]) == '\n') *tmp = '\0';