summaryrefslogtreecommitdiffstats
path: root/source/core
diff options
context:
space:
mode:
authorEllie Hermaszewska <ellieh@nvidia.com>2023-03-31 03:46:27 +0800
committerGitHub <noreply@github.com>2023-03-30 12:46:27 -0700
commit72f792858a951821ff266295e018c9472fe02a14 (patch)
tree2746943e6ecf1dc9c2d9672c332091a7a1a0e382 /source/core
parentd01e28a49b47c9fadf2b764a74f318e3f95061e5 (diff)
Fix mismatched malloc/delete[] in toWString (#2758)
Co-authored-by: Yong He <yonghe@outlook.com>
Diffstat (limited to 'source/core')
-rw-r--r--source/core/slang-string.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/core/slang-string.cpp b/source/core/slang-string.cpp
index c02ba048d..dc3c3ed46 100644
--- a/source/core/slang-string.cpp
+++ b/source/core/slang-string.cpp
@@ -373,9 +373,9 @@ namespace Slang
wchar_t* beginData = (wchar_t*)buf.getBuffer();
wchar_t* endData = beginData + length;
- buf.detachBuffer();
-
- return OSString(beginData, endData);
+ OSString ret;
+ ret.set(beginData, endData);
+ return ret;
}
}