Merge "CtsSecurityTestCases.android.security.cts.StagefrightTest#testStagefright_cve_2016_2507" into main
diff --git a/media/libstagefright/FrameDecoder.cpp b/media/libstagefright/FrameDecoder.cpp
index 893b442..cc78510 100644
--- a/media/libstagefright/FrameDecoder.cpp
+++ b/media/libstagefright/FrameDecoder.cpp
@@ -654,7 +654,9 @@
     mReadOptions.clearSeekTo();
     if (err != OK) {
         ALOGW("Input Error: err=%d", err);
-        mediaBuffer->release();
+        if (mediaBuffer) {
+            mediaBuffer->release();
+        }
         return err;
     }