diff --git a/src/parse_tree.cpp b/src/parse_tree.cpp index f3bbdbf43..32da0cf10 100644 --- a/src/parse_tree.cpp +++ b/src/parse_tree.cpp @@ -123,23 +123,14 @@ void parse_error_offset_source_start(parse_error_list_t *errors, size_t amt) { const wchar_t *token_type_description(parse_token_type_t type) { const wchar_t *description = enum_to_str(type, token_enum_map); if (description) return description; + return L"unknown_token_type"; - // This leaks memory but it should never be run unless we have a bug elsewhere in the code. - const wcstring d = format_string(L"unknown_token_type_%ld", static_cast(type)); - wchar_t *d2 = new wchar_t[d.size() + 1]; - // cppcheck-suppress memleak - return std::wcscpy(d2, d.c_str()); } const wchar_t *keyword_description(parse_keyword_t type) { const wchar_t *keyword = enum_to_str(type, keyword_enum_map); if (keyword) return keyword; - - // This leaks memory but it should never be run unless we have a bug elsewhere in the code. - const wcstring d = format_string(L"unknown_keyword_%ld", static_cast(type)); - wchar_t *d2 = new wchar_t[d.size() + 1]; - // cppcheck-suppress memleak - return std::wcscpy(d2, d.c_str()); + return L"unknown_keyword"; } static wcstring token_type_user_presentable_description(