hal: Add clear_devices to avoid memory leakage

In case of device update, it will alloc memory for new device,
Add the corresponding clear_devices to avoid the memory leakage.

Change-Id: If8498bad04146f383073e521a7d74fe20564f880
diff --git a/hal/msm8974/platform.c b/hal/msm8974/platform.c
index 9638643..59c3c8f 100755
--- a/hal/msm8974/platform.c
+++ b/hal/msm8974/platform.c
@@ -6940,6 +6940,7 @@
         ALOGE("%s: Unknown device(s) %#x", __func__, get_device_types(&devices));
     }
 exit:
+    clear_devices(&devices);
     ALOGV("%s: exit: snd_device(%s)", __func__, device_table[snd_device]);
     return snd_device;
 }
@@ -7784,6 +7785,7 @@
         }
     }
 exit:
+    clear_devices(&in_devices);
     ALOGV("%s: exit: in_snd_device(%s)", __func__, device_table[snd_device]);
     return snd_device;
 }