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

Commit 0d64169b authored by Praveena Pachipulusu's avatar Praveena Pachipulusu Committed by Steve Kondik
Browse files

SF: Fix Klockwork errors.

Resolve klockwork errors in frameworks/native
to avoid buffer overflow and memory leaks.

Change-Id: I7af17047538e621c872377090cea5b96f0924883
parent e30a8171
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -874,8 +874,10 @@ status_t Surface::lock(

        { // scope for the lock
            Mutex::Autolock lock(mMutex);
            if (backBufferSlot >= 0) {
               mSlots[backBufferSlot].dirtyRegion = newDirtyRegion;
            }
        }

        if (inOutDirtyBounds) {
            *inOutDirtyBounds = newDirtyRegion.getBounds();
+4 −1
Original line number Diff line number Diff line
@@ -176,8 +176,11 @@ status_t SurfaceControl::writeSurfaceToParcel(
    if (control != NULL) {
        bp = control->mGraphicBufferProducer;
    }
    if (bp != NULL) {
        return parcel->writeStrongBinder(bp->asBinder());
    }
    return NO_INIT;
}

sp<Surface> SurfaceControl::getSurface() const
{
+3 −1
Original line number Diff line number Diff line
@@ -800,7 +800,9 @@ SharedBuffer const* Region::getSharedBuffer(size_t* count) const {
        size_t numRects = isRect() ? 1 : mStorage.size() - 1;
        count[0] = numRects;
    }
    if (sb != NULL) {
       sb->acquire();
    }
    return sb;
}

+2 −0
Original line number Diff line number Diff line
@@ -583,6 +583,8 @@ status_t HWComposer::createWorkList(int32_t id, size_t numLayers) {
                    + numLayers * sizeof(hwc_layer_1_t);
            free(disp.list);
            disp.list = (hwc_display_contents_1_t*)malloc(size);
            if(disp.list == NULL)
                return NO_MEMORY;
            disp.capacity = numLayers;
        }
        if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) {