| Index: Source/wtf/text/StringImpl.cpp
|
| diff --git a/Source/wtf/text/StringImpl.cpp b/Source/wtf/text/StringImpl.cpp
|
| index f4ff9a4053596360ca71dbc563f29ff5117c5d23..a3bf6e1ce3ca044b4313c4424cb1db85655a10f6 100644
|
| --- a/Source/wtf/text/StringImpl.cpp
|
| +++ b/Source/wtf/text/StringImpl.cpp
|
| @@ -25,6 +25,7 @@
|
| #include "config.h"
|
| #include "wtf/text/StringImpl.h"
|
|
|
| +#include "wtf/LeakAnnotations.h"
|
| #include "wtf/StdLibExtras.h"
|
| #include "wtf/text/AtomicString.h"
|
| #include "wtf/text/StringBuffer.h"
|
| @@ -345,11 +346,14 @@ StringImpl* StringImpl::createStatic(const char* string, unsigned length, unsign
|
| // heap allocation from this call.
|
| RELEASE_ASSERT(length <= ((std::numeric_limits<unsigned>::max() - sizeof(StringImpl)) / sizeof(LChar)));
|
| size_t size = sizeof(StringImpl) + length * sizeof(LChar);
|
| - StringImpl* impl = static_cast<StringImpl*>(fastMalloc(size));
|
| -
|
| - LChar* data = reinterpret_cast<LChar*>(impl + 1);
|
| - impl = new (NotNull, impl) StringImpl(length, hash, StaticString);
|
| - memcpy(data, string, length * sizeof(LChar));
|
| + StringImpl* impl;
|
| + {
|
| + WTF_ANNOTATE_SCOPED_MEMORY_LEAK;
|
| + impl = static_cast<StringImpl*>(fastMalloc(size));
|
| + LChar* data = reinterpret_cast<LChar*>(impl + 1);
|
| + impl = new (NotNull, impl) StringImpl(length, hash, StaticString);
|
| + memcpy(data, string, length * sizeof(LChar));
|
| + }
|
| #ifndef NDEBUG
|
| impl->assertHashIsCorrect();
|
| #endif
|
|
|