diff options
author | Igor Murashkin <iam@google.com> | 2014-03-17 13:01:41 -0700 |
---|---|---|
committer | Igor Murashkin <iam@google.com> | 2014-03-17 13:01:41 -0700 |
commit | bd3e2e03f3ab686c52982a9e50cae853128172cf (patch) | |
tree | 08e6182c089c0377db4b5c0010b30a16d8f2e5ba | |
parent | 75dcf5101c90e31bbac95694d835b0e8f57ba720 (diff) | |
download | frameworks_av-bd3e2e03f3ab686c52982a9e50cae853128172cf.zip frameworks_av-bd3e2e03f3ab686c52982a9e50cae853128172cf.tar.gz frameworks_av-bd3e2e03f3ab686c52982a9e50cae853128172cf.tar.bz2 |
camera2: Fix segfault when using null availability listener
ICameraService::addListener / removeListener will now return BAD_VALUE
if a null listener is used.
Bug: 12891434
Change-Id: I9764110094d8fd42e22fcc8df3ef0e73c1b070e7
-rw-r--r-- | services/camera/libcameraservice/CameraService.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/services/camera/libcameraservice/CameraService.cpp b/services/camera/libcameraservice/CameraService.cpp index eeedfc9..5957d97 100644 --- a/services/camera/libcameraservice/CameraService.cpp +++ b/services/camera/libcameraservice/CameraService.cpp @@ -655,6 +655,11 @@ status_t CameraService::addListener( const sp<ICameraServiceListener>& listener) { ALOGV("%s: Add listener %p", __FUNCTION__, listener.get()); + if (listener == 0) { + ALOGE("%s: Listener must not be null", __FUNCTION__); + return BAD_VALUE; + } + Mutex::Autolock lock(mServiceLock); Vector<sp<ICameraServiceListener> >::iterator it, end; @@ -683,6 +688,11 @@ status_t CameraService::removeListener( const sp<ICameraServiceListener>& listener) { ALOGV("%s: Remove listener %p", __FUNCTION__, listener.get()); + if (listener == 0) { + ALOGE("%s: Listener must not be null", __FUNCTION__); + return BAD_VALUE; + } + Mutex::Autolock lock(mServiceLock); Vector<sp<ICameraServiceListener> >::iterator it; |