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

Commit 371f9575 authored by Sungtak Lee's avatar Sungtak Lee Committed by Android (Google) Code Review
Browse files

Merge "Handle gralloc handle leaks"

parents 0d26513d 2729dcf5
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -225,14 +225,18 @@ status_t C2OMXNode::emptyBuffer(
    if (omxBuf.mBufferType == OMXBuffer::kBufferTypeANWBuffer
            && omxBuf.mGraphicBuffer != nullptr) {
        std::shared_ptr<C2GraphicAllocation> alloc;
        native_handle_t *clonedHandle = native_handle_clone(omxBuf.mGraphicBuffer->handle);
        handle = WrapNativeCodec2GrallocHandle(
                native_handle_clone(omxBuf.mGraphicBuffer->handle),
                clonedHandle,
                omxBuf.mGraphicBuffer->width,
                omxBuf.mGraphicBuffer->height,
                omxBuf.mGraphicBuffer->format,
                omxBuf.mGraphicBuffer->usage,
                omxBuf.mGraphicBuffer->stride);
        c2_status_t err = mAllocator->priorGraphicAllocation(handle, &alloc);
        if (clonedHandle) {
            native_handle_delete(clonedHandle);
        }
        if (err != OK) {
            return UNKNOWN_ERROR;
        }
+5 −0
Original line number Diff line number Diff line
@@ -316,6 +316,11 @@ C2AllocationGralloc::~C2AllocationGralloc() {
        native_handle_delete(
                const_cast<native_handle_t *>(reinterpret_cast<const native_handle_t *>(mHandle)));
    }
    if (mLockedHandle) {
        native_handle_delete(
                const_cast<native_handle_t *>(
                        reinterpret_cast<const native_handle_t *>(mLockedHandle)));
    }
}

c2_status_t C2AllocationGralloc::map(