Merge d08e0f3ab8de397fe5d6a0447e9cb2d6239a1635 on remote branch

Change-Id: I766081d3b21284aacc774f4a4f1fb58cc83b8c03
diff --git a/plugins/tinyalsa/src/agm_mixer_plugin.c b/plugins/tinyalsa/src/agm_mixer_plugin.c
index cb85c9d..1cd1e16 100644
--- a/plugins/tinyalsa/src/agm_mixer_plugin.c
+++ b/plugins/tinyalsa/src/agm_mixer_plugin.c
@@ -1485,6 +1485,7 @@
     free(pcm_adi->get_param_info[idx].get_param_payload);
     pcm_adi->get_param_info[idx].get_param_payload = NULL;
     pcm_adi->get_param_info[idx].get_param_payload_size = 0;
+    errno = ret;
     return ret;
 }
 
diff --git a/service/src/session_obj.c b/service/src/session_obj.c
index f9f43d1..8d645fc 100644
--- a/service/src/session_obj.c
+++ b/service/src/session_obj.c
@@ -2305,7 +2305,6 @@
             sess_cb->cb(sess_obj->sess_id,
                         (struct agm_event_cb_params *)event_params,
                         sess_cb->client_data);
-            break;
         }
     }
     pthread_mutex_unlock(&sess_obj->cb_pool_lock);
diff --git a/snd_parser/src/snd-card-parser.c b/snd_parser/src/snd-card-parser.c
index 37824e6..96b8776 100644
--- a/snd_parser/src/snd-card-parser.c
+++ b/snd_parser/src/snd-card-parser.c
@@ -25,6 +25,10 @@
 ** WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
 ** OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
 ** IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*  Changes from Qualcomm Innovation Center are provided under the following license:
+*
+*  Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
+*  SPDX-License-Identifier: BSD-3-Clause-Clear
 **/
 
 #include <errno.h>
@@ -486,7 +490,8 @@
         if (card_found) {
             card_def->refcnt++;
             pthread_rwlock_unlock(&snd_rwlock);
-            free(snd_card_name);
+            if (snd_card_name != NULL)
+               free(snd_card_name);
             return card_def;
         }
     }
@@ -496,7 +501,8 @@
     file = fopen(CARD_DEF_FILE, "r");
     if (!file) {
         pthread_rwlock_unlock(&snd_rwlock);
-        free(snd_card_name);
+        if (snd_card_name != NULL )
+           free(snd_card_name);
         return NULL;
     }
 
@@ -504,7 +510,8 @@
     if (!parser) {
         fclose(file);
         pthread_rwlock_unlock(&snd_rwlock);
-        free(snd_card_name);
+        if (snd_card_name != NULL)
+           free(snd_card_name);
         return NULL;
     }
 
@@ -539,7 +546,8 @@
         card_def->refcnt++;
     }
 ret:
-    free(snd_card_name);
+    if (snd_card_name != NULL)
+       free(snd_card_name);
     card_data.card_name = NULL;
     XML_ParserFree(parser);
     fclose(file);