Fix memory leak in term_env

Use wcstring/string instead of a character array. The variable
`term_env` was not being freed before the function exited.

Fixes defect 7520324 in coverity scan.
This commit is contained in:
Mahmoud Al-Qudsi 2018-02-08 17:16:56 -06:00
parent 6108b1d813
commit 22a67885e1

View File

@ -548,8 +548,8 @@ static bool initialize_curses_using_fallback(const char *term) {
auto term_var = env_get(L"TERM");
if (term_var.missing_or_empty()) return false;
const char *term_env = wcs2str(term_var->as_string());
if (!strcmp(term_env, DEFAULT_TERM1) || !strcmp(term_env, DEFAULT_TERM2)) return false;
auto term_env = wcs2string(term_var->as_string());
if (term_env != DEFAULT_TERM1 || term_env != DEFAULT_TERM2) return false;
if (is_interactive_session) debug(1, _(L"Using fallback terminal type '%s'."), term);