Merge cherrypicks of [2780919, 2780841, 2780458, 2780892, 2780893, 2781183, 2781184, 2780842, 2780843, 2780920, 2780921, 2780922, 2780923, 2780924, 2780925, 2780926, 2780927, 2780894, 2780895, 2781304, 2780844, 2780845, 2780846, 2781209] into nyc-mr1-security-e-release

Change-Id: I6a31d4021fb023fc5ae2b78095a094279ab565be
diff --git a/camera/QCamera2/HAL3/QCamera3HWI.cpp b/camera/QCamera2/HAL3/QCamera3HWI.cpp
index 1a9079a..08b5734 100644
--- a/camera/QCamera2/HAL3/QCamera3HWI.cpp
+++ b/camera/QCamera2/HAL3/QCamera3HWI.cpp
@@ -1288,6 +1288,7 @@
                 newStream->max_buffers = MAX_INFLIGHT_REPROCESS_REQUESTS;
             } else {
                 ALOGE("%s: Error, Unknown stream type", __func__);
+                pthread_mutex_unlock(&mMutex);
                 return -EINVAL;
             }
 
@@ -2347,6 +2348,7 @@
     } else if (mFirstRequest || mCurrentRequestId == -1){
         ALOGE("%s: Unable to find request id field, \
                 & no previous id available", __func__);
+        pthread_mutex_unlock(&mMutex);
         return NAME_NOT_FOUND;
     } else {
         CDBG("%s: Re-using old request id", __func__);