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

Commit 8faebbc0 authored by Lajos Molnar's avatar Lajos Molnar
Browse files

codec2: unlock GraphicBuffer if lockYCbCr succeeded but could not process it

We may be able to lockYCbCr a graphic buffer and not understand it
(e.g. stride could be invalid). Unlock it before trying to relock using
lock().

Bug: 190459461
Change-Id: I916381cd04a4ff2180b9052a9a58d9092412e932
parent 2ffec4c9
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -750,6 +750,16 @@ c2_status_t C2AllocationGralloc::map(

            // We really don't know what this is; lock the buffer and pass it through ---
            // the client may know how to interpret it.

            // unlock previous allocation if it was successful
            if (err == OK) {
                err = GraphicBufferMapper::get().unlock(mBuffer);
                if (err) {
                    ALOGE("failed transaction: unlock");
                    return C2_CORRUPTED;
                }
            }

            void *pointer = nullptr;
            err = GraphicBufferMapper::get().lock(
                    const_cast<native_handle_t *>(mBuffer), grallocUsage, rect, &pointer);