Bug 1305791 - Clear result.mSegments if MoveFallible failed. r=billm, a=gchang
authorKan-Ru Chen <kanru@kanru.info>
Fri, 30 Sep 2016 17:37:44 +0800
changeset 358247 baf093efb4003b25629197f15a13bc1e785ff1a4
parent 358246 fb564edbd98d079e2549713ecb96d90e17fd31a4
child 358248 ca710272133c70d68ba587ccf45d6567e5e830b8
push id1324
push usermtabara@mozilla.com
push dateMon, 16 Jan 2017 13:07:44 +0000
treeherdermozilla-release@a01c49833940 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbillm, gchang
bugs1305791
milestone51.0a2
Bug 1305791 - Clear result.mSegments if MoveFallible failed. r=billm, a=gchang MozReview-Commit-ID: 8UaGt1OEfhh
mfbt/BufferList.h
--- a/mfbt/BufferList.h
+++ b/mfbt/BufferList.h
@@ -392,16 +392,17 @@ BufferList<AllocPolicy>::MoveFallible(bo
   BufferList<OtherAllocPolicy> result(0, 0, mStandardCapacity, aAP);
 
   IterImpl iter = Iter();
   while (!iter.Done()) {
     size_t toAdvance = iter.RemainingInSegment();
 
     if (!toAdvance || !result.mSegments.append(typename BufferList<OtherAllocPolicy>::Segment(iter.mData, toAdvance, toAdvance))) {
       *aSuccess = false;
+      result.mSegments.clear();
       return result;
     }
     iter.Advance(*this, toAdvance);
   }
 
   result.mSize = mSize;
   mSegments.clear();
   mSize = 0;