diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c
index 3e82a38..21ee98d 100644
--- a/ncurses/tinfo/lib_setup.c
+++ b/ncurses/tinfo/lib_setup.c
@@ -783,14 +783,12 @@ TINFO_SETUP_TERM(TERMINAL ** tp,
if ((VALID_STRING(cursor_address)
|| (VALID_STRING(cursor_down) && VALID_STRING(cursor_home)))
&& VALID_STRING(clear_screen)) {
- free(termp);
ret_error1(TGETENT_YES, "terminal is not really generic.\n", tname);
} else {
- free(termp);
+ del_curterm(termp);
ret_error1(TGETENT_NO, "I need something more specific.\n", tname);
}
} else if (hard_copy) {
- free(termp);
ret_error1(TGETENT_YES, "I can't handle hardcopy terminals.\n", tname);
}
#endif