mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-27 16:51:15 -03:00
Make escape() return a wcstring
This avoids the potential for leaking the resulting string.
This commit is contained in:
@@ -1120,7 +1120,7 @@ static void escape_string_internal(const wchar_t *orig_in, size_t in_len, wcstri
|
||||
}
|
||||
}
|
||||
|
||||
wchar_t *escape(const wchar_t *in, escape_flags_t flags)
|
||||
wcstring escape(const wchar_t *in, escape_flags_t flags)
|
||||
{
|
||||
if (!in)
|
||||
{
|
||||
@@ -1128,9 +1128,9 @@ wchar_t *escape(const wchar_t *in, escape_flags_t flags)
|
||||
FATAL_EXIT();
|
||||
}
|
||||
|
||||
wcstring tmp;
|
||||
escape_string_internal(in, wcslen(in), &tmp, flags);
|
||||
return wcsdup(tmp.c_str());
|
||||
wcstring result;
|
||||
escape_string_internal(in, wcslen(in), &result, flags);
|
||||
return result;
|
||||
}
|
||||
|
||||
wcstring escape_string(const wcstring &in, escape_flags_t flags)
|
||||
|
||||
Reference in New Issue
Block a user