Error handling in case termcap entry can't be found

This commit is contained in:
Stephen Heumann 2014-12-26 23:13:52 -06:00
parent 6dfc5eadb3
commit 5b1c69f8d6
1 changed files with 4 additions and 1 deletions

View File

@ -276,7 +276,10 @@ static void init_termcap(void)
termcap_buffer = malloc(TERMCAP_BUFSIZ);
if (termcap_buffer == NULL)
return;
tgetent(termcap_buffer, term);
if (tgetent(termcap_buffer, term) != 1) {
free(termcap_buffer);
return;
}
result = tgetstr("up", &string_buf);
if (result != NULL)