aboutsummaryrefslogtreecommitdiff
path: root/ui-curses.c
diff options
context:
space:
mode:
authorMarc André Tanner <mat@brain-dump.org>2016-10-05 22:06:06 +0200
committerMarc André Tanner <mat@brain-dump.org>2016-10-05 22:06:06 +0200
commitfc575f6986d19205a3b97f1813246529c6d2fc79 (patch)
tree73f14c6bae1306f9510f95579438d18fcaf01754 /ui-curses.c
parente3c1f30e6d8dc15b35842d847f87954b4aa046e0 (diff)
downloadvis-fc575f6986d19205a3b97f1813246529c6d2fc79.tar.gz
vis-fc575f6986d19205a3b97f1813246529c6d2fc79.tar.xz
Fix various issues reported by coverity scan
Diffstat (limited to 'ui-curses.c')
-rw-r--r--ui-curses.c4
1 files changed, 3 insertions, 1 deletions
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)))