notcurses_init(): drop_signals on error path

pull/632/head
nick black 4 years ago
parent 38e67abd9d
commit e2a9094ed0
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC

@ -917,7 +917,8 @@ notcurses* notcurses_init(const notcurses_options* opts, FILE* outfp){
if(tcsetattr(ret->ttyfd, TCSANOW, &modtermios)){
fprintf(stderr, "Error disabling echo / canonical on %d (%s)\n",
ret->ttyfd, strerror(errno));
goto err;
free(ret);
return NULL;
}
if(setup_signals(ret, opts->no_quit_sighandlers, opts->no_winch_sighandler)){
goto err;
@ -1001,6 +1002,7 @@ notcurses* notcurses_init(const notcurses_options* opts, FILE* outfp){
err:
// FIXME looks like we have some memory leaks on this error path?
tcsetattr(ret->ttyfd, TCSANOW, &ret->tpreserved);
drop_signals(ret);
free(ret);
return NULL;
}

Loading…
Cancel
Save