diff options
author | 2014-09-25 18:20:03 -0700 | |
---|---|---|
committer | 2014-09-25 18:20:03 -0700 | |
commit | 35595dbffdf413694b31da46129432ef345921af (patch) | |
tree | e78b379cf7854b1a8402f8da267e8f6d84450c6f /common.cpp | |
parent | cd4fa518b86ddfb3e946fa4dd69e9e32a58ef81e (diff) |
Make escape() return a wcstring
This avoids the potential for leaking the resulting string.
Diffstat (limited to 'common.cpp')
-rw-r--r-- | common.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
@@ -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) |