You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
836 B

  1. From 198f7207427ad7f569aa3592ea16e2bb400db040 Mon Sep 17 00:00:00 2001
  2. From: Nathaniel McCallum <npmccallum@redhat.com>
  3. Date: Fri, 29 Sep 2017 14:49:57 -0400
  4. Subject: [PATCH] Fix minor FILE* leak
  5. ---
  6. cmd/jwe/pwd.h | 5 ++++-
  7. 1 file changed, 4 insertions(+), 1 deletion(-)
  8. diff --git a/cmd/jwe/pwd.h b/cmd/jwe/pwd.h
  9. index 0b5be54..2f021eb 100644
  10. --- a/cmd/jwe/pwd.h
  11. +++ b/cmd/jwe/pwd.h
  12. @@ -57,8 +57,10 @@ jwe_getpass(const char *prompt)
  13. nf.c_lflag &= ~ECHO;
  14. nf.c_lflag |= ECHONL;
  15. - if (tcsetattr(fileno(tty), TCSANOW, &nf) != 0)
  16. + if (tcsetattr(fileno(tty), TCSANOW, &nf) != 0) {
  17. + fclose(tty);
  18. return NULL;
  19. + }
  20. fprintf(tty, "%s", prompt);
  21. @@ -72,6 +74,7 @@ jwe_getpass(const char *prompt)
  22. }
  23. tcsetattr(fileno(tty), TCSANOW, &of);
  24. + fclose(tty);
  25. return pwd;
  26. }
  27. #endif