Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9d10dbd authored by Michael Wachenschwanz's avatar Michael Wachenschwanz
Browse files

Resize object capacity when shrinking Parcel

Bug: 140419401
Test: atest android.os.cts.ParcelTest
Change-Id: I04edee415e1984ba5fb97c5c1b09892a360cf221
(cherry picked from commit c67d9f33)
parent dbd0eecf
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -2713,11 +2713,13 @@ status_t Parcel::continueWrite(size_t desired)
            if (objectsSize == 0) {
                free(mObjects);
                mObjects = nullptr;
                mObjectsCapacity = 0;
            } else {
                binder_size_t* objects =
                    (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t));
                if (objects) {
                    mObjects = objects;
                    mObjectsCapacity = objectsSize;
                }
            }
            mObjectsSize = objectsSize;