Changeset 240896 in webkit


Ignore:
Timestamp:
Feb 2, 2019 10:35:42 AM (5 years ago)
Author:
ddkilzer@apple.com
Message:

Leak of WTF::StringImpl under SymbolImpl::createNullSymbol() (48 bytes) in com.apple.WebKit.WebContent running layout tests
<https://webkit.org/b/193291>
<rdar://problem/46655953>

Reviewed by Keith Miller.

  • wtf/text/SymbolImpl.h:

(WTF::SymbolImpl::~SymbolImpl): Fix the leak by implementing the
class destructor that calls StringImpl::deref() on m_owner.
Two of the three constructors leak the StringImpl when setting
m_owner, so we need to balance that by manually calling
deref().

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r240892 r240896  
     12019-02-02  David Kilzer  <ddkilzer@apple.com>
     2
     3        Leak of WTF::StringImpl under SymbolImpl::createNullSymbol() (48 bytes) in com.apple.WebKit.WebContent running layout tests
     4        <https://webkit.org/b/193291>
     5        <rdar://problem/46655953>
     6
     7        Reviewed by Keith Miller.
     8
     9        * wtf/text/SymbolImpl.h:
     10        (WTF::SymbolImpl::~SymbolImpl): Fix the leak by implementing the
     11        class destructor that calls StringImpl::deref() on `m_owner`.
     12        Two of the three constructors leak the StringImpl when setting
     13        `m_owner`, so we need to balance that by manually calling
     14        deref().
     15
    1162018-12-16  Darin Adler  <darin@apple.com>
    217
  • trunk/Source/WTF/wtf/text/SymbolImpl.h

    r231337 r240896  
    117117    }
    118118
     119    ~SymbolImpl()
     120    {
     121        if (m_owner != StringImpl::empty())
     122            m_owner->deref();
     123        m_owner = nullptr;
     124    }
     125
    119126    // The pointer to the owner string should be immediately following after the StringImpl layout,
    120127    // since we would like to align the layout of SymbolImpl to the one of BufferSubstring StringImpl.
Note: See TracChangeset for help on using the changeset viewer.