Merge "st-hal: Fix double free in merge sound models logic"
diff --git a/st_session.c b/st_session.c
index 7bf02d9..00c2cee 100644
--- a/st_session.c
+++ b/st_session.c
@@ -2354,11 +2354,12 @@
          * handle here.
          * For now just copy the the current client data which is same
          * across SVA engines.
+         * Update the custom data for the case in which one client session
+         * does not have custom data and another one does.
          */
-        if (!sthw_cfg->custom_data) {
+        if (rc_config->data_size > sthw_cfg->custom_data_size) {
             sthw_cfg->custom_data = (char *)rc_config + rc_config->data_offset;
-            if (rc_config->data_size)
-                sthw_cfg->custom_data_size =  rc_config->data_size;
+            sthw_cfg->custom_data_size =  rc_config->data_size;
         }
 
     } else {
@@ -5635,9 +5636,9 @@
     st_proxy_session_t *st_ses = stc_ses->hw_proxy_ses;
     st_session_ev_t ev = { .ev_id = ST_SES_EV_PAUSE, .stc_ses = stc_ses };
 
-    pthread_mutex_lock(&stc_ses->lock);
+    pthread_mutex_lock(&st_ses->lock);
     DISPATCH_EVENT(st_ses, ev, status);
-    pthread_mutex_unlock(&stc_ses->lock);
+    pthread_mutex_unlock(&st_ses->lock);
     return status;
 }