Ignore:
Timestamp:
Jun 16, 2008, 11:22:46 PM (17 years ago)
Author:
[email protected]
Message:

2008-06-16 Cameron Zwarich <[email protected]>

Reviewed by Maciej.

Bug 19596: LEAK: Gmail leaks SegmentedVector<RegisterID>
<https://bugs.webkit.org/show_bug.cgi?id=19596>

When growing SegmentedVector, we start adding segments at the position
of the last segment, overwriting it. The destructor frees allocated
segments starting at the segment of index 1, because the segment of
index 0 is assumed to be the initial inline segment. This causes a leak
of the segment that is referenced by index 0. Modifying grow() so that
it starts adding segments at the position after the last segment fixes
the leak.

Since the initial segment is a special case in the lookup code, this
bug never manifested itself via incorrect results.

  • VM/SegmentedVector.h: (KJS::SegmentedVector::grow):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/VM/SegmentedVector.h

    r34372 r34617  
    145145
    146146            ASSERT(oldSize < m_segments.size());
    147             for (size_t i = oldSize - 1; i < (numSegments - 1); i++) {
     147            for (size_t i = oldSize; i < (numSegments - 1); i++) {
    148148                Segment* segment = new Segment;
    149149                segment->resize(SegmentSize);
Note: See TracChangeset for help on using the changeset viewer.