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

Commit 27d83834 authored by Jeff Brown's avatar Jeff Brown
Browse files

Fix possible leak in bitmap decoding.

In one particular error case, we might exit the function without
destroying the bitmap.

Bug: 6467873 (tangentially related)
Change-Id: I3a213cc0a53023d9d0d2a080aed15774f4c4c10c
parent ca13fed0
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -317,8 +317,6 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
            env->SetObjectField(javaBitmap, gBitmap_layoutBoundsFieldID, layoutBounds);
        }
    }
    // detach bitmap from its autodeleter, since we want to own it now
    adb.detach();

    if (willScale) {
        // This is weird so let me explain: we could use the scale parameter
@@ -369,6 +367,9 @@ static jobject doDecode(JNIEnv* env, SkStream* stream, jobject padding,
        pr->setImmutable();
    }

    // detach bitmap from its autodeleter, since we want to own it now
    adb.detach();

    if (javaBitmap != NULL) {
        // If a java bitmap was passed in for reuse, pass it back
        return javaBitmap;