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

Commit 037f268d authored by Tri Vo's avatar Tri Vo Committed by android-build-merger
Browse files

Merge "libbinder: keep ashmem size >= 0"

am: 5805df43

Change-Id: Id46cf33b6e0d48a1173d39301ffdcde15caff343
parents 3f3a196a 5805df43
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -181,7 +181,10 @@ static void release_object(const sp<ProcessState>& proc,
                if ((outAshmemSize != nullptr) && ashmem_valid(obj.handle)) {
                    int size = ashmem_get_size_region(obj.handle);
                    if (size > 0) {
                        *outAshmemSize -= size;
                        // ashmem size might have changed since last time it was accounted for, e.g.
                        // in acquire_object(). Value of *outAshmemSize is not critical since we are
                        // releasing the object anyway. Check for integer overflow condition.
                        *outAshmemSize -= std::min(*outAshmemSize, static_cast<size_t>(size));
                    }
                }