only use tpreserved when it's not NULL #2132

pull/2137/head
nick black 3 years ago
parent 0fd2fe7ce1
commit 0ee5ba4ffe
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -1258,9 +1258,11 @@ notcurses* notcurses_core_init(const notcurses_options* opts, FILE* outfp){
err:
logpanic("Alas, you will not be going to space today.\n");
// FIXME looks like we have some memory leaks on this error path?
fbuf_free(&ret->rstate.f);
(void)tcsetattr(ret->tcache.ttyfd, TCSAFLUSH, ret->tcache.tpreserved);
if(ret->tcache.tpreserved){
(void)tcsetattr(ret->tcache.ttyfd, TCSAFLUSH, ret->tcache.tpreserved);
free(ret->tcache.tpreserved);
}
drop_signals(ret);
del_curterm(cur_term);
pthread_mutex_destroy(&ret->stats.lock);

@ -921,7 +921,7 @@ int interrogate_terminfo(tinfo* ti, const char* termtype, FILE* out, unsigned ut
return 0;
err:
if(ti->ttyfd >= 0){
if(ti->tpreserved){
tcsetattr(ti->ttyfd, TCSANOW, ti->tpreserved);
}
free(ti->tpreserved);

Loading…
Cancel
Save