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

Commit 0d26513d authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "C2: Delete mHandle properly to avoid memory leakage"

parents 86feaec0 fa94a3ba
Loading
Loading
Loading
Loading
+8 −7
Original line number Diff line number Diff line
@@ -304,17 +304,18 @@ C2AllocationGralloc::C2AllocationGralloc(
}

C2AllocationGralloc::~C2AllocationGralloc() {
    if (!mBuffer) {
        return;
    }
    if (mLocked) {
    if (mBuffer && mLocked) {
        // implementation ignores addresss and rect
        uint8_t* addr[C2PlanarLayout::MAX_NUM_PLANES] = {};
        unmap(addr, C2Rect(), nullptr);
    }
    if (mBuffer) {
        mMapper->freeBuffer(const_cast<native_handle_t *>(mBuffer));
    native_handle_delete(const_cast<native_handle_t*>(
            reinterpret_cast<const native_handle_t*>(mHandle)));
    }
    if (mHandle) {
        native_handle_delete(
                const_cast<native_handle_t *>(reinterpret_cast<const native_handle_t *>(mHandle)));
    }
}

c2_status_t C2AllocationGralloc::map(