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

Commit 23b3803b authored by Mahesh Lanka's avatar Mahesh Lanka Committed by Wonsik Kim
Browse files

MediaRecorderClient: Fix binder dereference while connecting to camera

IServiceManager.getService can return NULL. Check for NULL and
return NO_INIT on failure.

Bug: 34870127
Test: adb shell am instrument -e size small -w 'android.media.cts/android.support.test.runner.AndroidJUnitRunner'
Change-Id: I6d71f8c0e89a556e64f5250ba1ab742e485f1ebc
parent 7ec2a45e
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -465,6 +465,10 @@ status_t MediaRecorderClient::setListener(const sp<IMediaRecorderClient>& listen
    } else {
        // Legacy IOMX
        binder = sm->getService(String16("media.codec"));
        if (binder == NULL) {
           ALOGE("Unable to connect to media codec service");
           return NO_INIT;
        }
        mCodecDeathListener = new ServiceDeathNotifier(binder, listener,
                MediaPlayerService::MEDIACODEC_PROCESS_DEATH);
        binder->linkToDeath(mCodecDeathListener);