Merge 21351394b8ab9475b7389453bbcd351ba579e4b9 on remote branch

Change-Id: Ia4547b265e7902259064a11c57573e2f4d438100
diff --git a/plugins/tinyalsa/test/agmhostless.c b/plugins/tinyalsa/test/agmhostless.c
index 4819725..36e22b5 100644
--- a/plugins/tinyalsa/test/agmhostless.c
+++ b/plugins/tinyalsa/test/agmhostless.c
@@ -264,7 +264,7 @@
         goto err_close_mixer;
     }
 
-    if (set_agm_stream_metadata(mixer, c_device, stream_kv, LOOPBACK, STREAM_PCM,
+    if (set_agm_stream_metadata(mixer, p_device, stream_kv, LOOPBACK, STREAM_PCM,
                                 0)) {
         printf("Failed to capture stream metadata\n");
         goto err_close_mixer;
diff --git a/service/src/device.c b/service/src/device.c
index b333730..808b927 100644
--- a/service/src/device.c
+++ b/service/src/device.c
@@ -1094,7 +1094,7 @@
     /* maximum wait period = (MAX_RETRY * RETRY_INTERVAL_US) micro-seconds */
     do {
         if ((fd = open(SNDCARD_PATH, O_RDWR)) < 0) {
-            AGM_LOGE(LOG_TAG, "Failed to open snd sysfs node, will retry for %d times ...", (retries - 1));
+            AGM_LOGE("Failed to open snd sysfs node, will retry for %d times ...", (retries - 1));
         } else {
             memset(buf , 0 ,sizeof(buf));
             lseek(fd,0L,SEEK_SET);
@@ -1107,7 +1107,7 @@
             sscanf(buf , "%d", &card_status);
 
             if (card_status == SND_CARD_STATUS_ONLINE) {
-                AGM_LOGV(LOG_TAG, "snd sysfs node open successful");
+                AGM_LOGV("snd sysfs node open successful");
                 break;
             }
         }
@@ -1116,7 +1116,7 @@
     } while ( retries > 0);
 
     if (0 == retries) {
-        AGM_LOGE(LOG_TAG, "Failed to open snd sysfs node, exiting ... ");
+        AGM_LOGE("Failed to open snd sysfs node, exiting ... ");
         ret = -EIO;
     }
 
diff --git a/service/src/session_obj.c b/service/src/session_obj.c
index 1050acb..be3591a 100644
--- a/service/src/session_obj.c
+++ b/service/src/session_obj.c
@@ -1299,6 +1299,8 @@
                 free(aif_obj->tag_config);
                 aif_obj->tag_config = NULL;
             }
+            list_remove(&aif_obj->node);
+            aif_free(aif_obj);
         }
     }
     pthread_mutex_unlock(&hwep_lock);