Skip to content

Commit

Permalink
Fix minor FILE* leak
Browse files Browse the repository at this point in the history
  • Loading branch information
npmccallum committed Sep 29, 2017
1 parent 89d90a6 commit 198f720
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cmd/jwe/pwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,10 @@ jwe_getpass(const char *prompt)
nf.c_lflag &= ~ECHO;
nf.c_lflag |= ECHONL;

if (tcsetattr(fileno(tty), TCSANOW, &nf) != 0)
if (tcsetattr(fileno(tty), TCSANOW, &nf) != 0) {
fclose(tty);
return NULL;
}

fprintf(tty, "%s", prompt);

Expand All @@ -72,6 +74,7 @@ jwe_getpass(const char *prompt)
}

tcsetattr(fileno(tty), TCSANOW, &of);
fclose(tty);
return pwd;
}
#endif

0 comments on commit 198f720

Please sign in to comment.