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

Commit ee0fe684 authored by Mikhail Naganov's avatar Mikhail Naganov Committed by Android Build Cherrypicker Worker
Browse files

libaudiohal@aidl: Fix 'localReply' scope in 'sendCommand'

Make sure that 'localReply' is available all the time
it is being accessed.

Bug: 333116473
Bug: 335014456
Test: m
(cherry picked from https://googleplex-android-review.googlesource.com/q/commit:f84ae5370242ec407ea143ca98eb1ffd78cf1f15)
Merged-In: I70a8fc7fb710a7a288509af3f8a57d0695c53b1a
Change-Id: I70a8fc7fb710a7a288509af3f8a57d0695c53b1a
parent 82ad2756
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -506,13 +506,13 @@ status_t StreamHalAidl::sendCommand(
                "%s %s: must be invoked from the worker thread (%d)",
                __func__, command.toString().c_str(), workerTid);
    }
    StreamDescriptor::Reply localReply{};
    {
        std::lock_guard l(mCommandReplyLock);
        if (!mContext.getCommandMQ()->writeBlocking(&command, 1)) {
            ALOGE("%s: failed to write command %s to MQ", __func__, command.toString().c_str());
            return NOT_ENOUGH_DATA;
        }
        StreamDescriptor::Reply localReply{};
        if (reply == nullptr) {
            reply = &localReply;
        }