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

Commit 2729dcf5 authored by Sungtak Lee's avatar Sungtak Lee
Browse files

Handle gralloc handle leaks

Delete locked handle from C2AllocatorGralloc.
Delete temporary cloned handle from C2OMXNode.

Bug: 122978854
Change-Id: I6cff2775380e85e4ca83315df06fe59a42e6a4ca
parent fa94a3ba
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(