Camera3: Protect against invalid memory access
QCamera3HardwareInterface destructor may be called
with mMetadataChannel not being created. This changes
protects against accessing un-initialized mMetadataChannel
object.
Change-Id: I50400334ac72503add0f87d6b4a30602ba29b9ee
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 03138e8..4fe8624 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -190,9 +190,11 @@
{
ALOGV("%s: E", __func__);
/* Clean up all channels */
- mMetadataChannel->stop();
- delete mMetadataChannel;
- mMetadataChannel = NULL;
+ if (mMetadataChannel) {
+ mMetadataChannel->stop();
+ delete mMetadataChannel;
+ mMetadataChannel = NULL;
+ }
/* We need to stop all streams before deleting any stream */
for (List<stream_info_t *>::iterator it = mStreamInfo.begin();
it != mStreamInfo.end(); it++) {