Title: [179245] trunk/Source/WTF
- Revision
- 179245
- Author
- [email protected]
- Date
- 2015-01-28 00:44:28 -0800 (Wed, 28 Jan 2015)
Log Message
Fix small leak in Collator
https://bugs.webkit.org/show_bug.cgi?id=140990
Reviewed by Andreas Kling.
* wtf/unicode/icu/CollatorICU.cpp:
(WTF::Collator::Collator): Use fastStrDup instead of strdup.
(WTF::Collator::~Collator): Use fastFree on the collator locale that we
are abandoning. The old code instead just called free on a null pointer.
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (179244 => 179245)
--- trunk/Source/WTF/ChangeLog 2015-01-28 08:09:25 UTC (rev 179244)
+++ trunk/Source/WTF/ChangeLog 2015-01-28 08:44:28 UTC (rev 179245)
@@ -1,3 +1,15 @@
+2015-01-28 Darin Adler <[email protected]>
+
+ Fix small leak in Collator
+ https://bugs.webkit.org/show_bug.cgi?id=140990
+
+ Reviewed by Andreas Kling.
+
+ * wtf/unicode/icu/CollatorICU.cpp:
+ (WTF::Collator::Collator): Use fastStrDup instead of strdup.
+ (WTF::Collator::~Collator): Use fastFree on the collator locale that we
+ are abandoning. The old code instead just called free on a null pointer.
+
2015-01-27 Geoffrey Garen <[email protected]>
Removed WTF_MALLOC_VALIDATION
Modified: trunk/Source/WTF/wtf/unicode/icu/CollatorICU.cpp (179244 => 179245)
--- trunk/Source/WTF/wtf/unicode/icu/CollatorICU.cpp 2015-01-28 08:09:25 UTC (rev 179244)
+++ trunk/Source/WTF/wtf/unicode/icu/CollatorICU.cpp 2015-01-28 08:44:28 UTC (rev 179245)
@@ -141,24 +141,20 @@
ucol_setAttribute(m_collator, UCOL_NORMALIZATION_MODE, UCOL_ON, &status);
ASSERT(U_SUCCESS(status));
- m_locale = locale ? strdup(locale) : nullptr;
+ m_locale = locale ? fastStrDup(locale) : nullptr;
m_shouldSortLowercaseFirst = shouldSortLowercaseFirst;
}
Collator::~Collator()
{
- {
- std::lock_guard<std::mutex> lock(cachedCollatorMutex());
- if (cachedCollator)
- ucol_close(cachedCollator);
- cachedCollator = m_collator;
- cachedCollatorLocale = m_locale;
- cachedCollatorShouldSortLowercaseFirst = m_shouldSortLowercaseFirst;
- m_collator = nullptr;
- m_locale = nullptr;
+ std::lock_guard<std::mutex> lock(cachedCollatorMutex());
+ if (cachedCollator) {
+ ucol_close(cachedCollator);
+ fastFree(cachedCollatorLocale);
}
-
- free(m_locale);
+ cachedCollator = m_collator;
+ cachedCollatorLocale = m_locale;
+ cachedCollatorShouldSortLowercaseFirst = m_shouldSortLowercaseFirst;
}
static int32_t getIndexLatin1(UCharIterator* iterator, UCharIteratorOrigin origin)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes