Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d37194f4 authored by Dhananjay Kumar's avatar Dhananjay Kumar
Browse files

policy_hal: fix possible NULL dereference reported in KW reports

Fix possible NULL dereference in custom policy manager inside method
getOutputForDevice().

Change-Id: I643d5e8401b03973284cef06820cc1cc914b0658
parent 5d1e8caa
Loading
Loading
Loading
Loading
+8 −8
Original line number Original line Diff line number Diff line
@@ -1802,6 +1802,8 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
                    }
                    }
                }
                }
            }
            }
            // close direct output if currently open and configured with different parameters
            if (outputDesc != NULL) {
                if (flags == AUDIO_OUTPUT_FLAG_DIRECT &&
                if (flags == AUDIO_OUTPUT_FLAG_DIRECT &&
                    direct_pcm_already_in_use == true &&
                    direct_pcm_already_in_use == true &&
                    session != outputDesc->mDirectClientSession) {
                    session != outputDesc->mDirectClientSession) {
@@ -1810,8 +1812,6 @@ audio_io_handle_t AudioPolicyManagerCustom::getOutputForDevice(
                    outputDesc->mDirectClientSession, session);
                    outputDesc->mDirectClientSession, session);
                    goto non_direct_output;
                    goto non_direct_output;
                }
                }
            // close direct output if currently open and configured with different parameters
            if (outputDesc != NULL) {
                closeOutput(outputDesc->mIoHandle);
                closeOutput(outputDesc->mIoHandle);
            }
            }
        }
        }