audio policy: fix crash in checkOutputForAttributes

New implementation of checkOutputForAttributes() dereferences
the profile of an output descriptor without checking that this is not
a duplicated output first (duplicated outputs do not have a profile).

Bug: 140916168
Test: repro steps in bug
Change-Id: Ic15674edc245ae33e40d0a025ce79bffcea852b1
diff --git a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
index 1f8ceec..14d6178 100644
--- a/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
+++ b/services/audiopolicy/managerdefault/AudioPolicyManager.cpp
@@ -5098,7 +5098,7 @@
             if (invalidate) continue;
 
             for (auto client : desc->clientsList(false /*activeOnly*/)) {
-                if (!desc->mProfile->isDirectOutput()) {
+                if (desc->isDuplicated() || !desc->mProfile->isDirectOutput()) {
                     // a client on a non direct outputs has necessarily a linear PCM format
                     // so we can call selectOutput() safely
                     const audio_io_handle_t newOutput = selectOutput(dstOutputs,