From fc575f6986d19205a3b97f1813246529c6d2fc79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Wed, 5 Oct 2016 22:06:06 +0200 Subject: Fix various issues reported by coverity scan --- ui-curses.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ui-curses.c') diff --git a/ui-curses.c b/ui-curses.c index 0873963..8f184e3 100644 --- a/ui-curses.c +++ b/ui-curses.c @@ -1103,8 +1103,10 @@ static const char *ui_getkey(Ui *ui) { int tty = open("/dev/tty", O_RDWR); if (tty == -1) goto fatal; - if (tty != STDIN_FILENO && dup2(tty, STDIN_FILENO) == -1) + if (tty != STDIN_FILENO && dup2(tty, STDIN_FILENO) == -1) { + close(tty); goto fatal; + } close(tty); termkey_destroy(uic->termkey); if (!(uic->termkey = ui_termkey_new(STDIN_FILENO))) -- cgit v1.2.3