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

Commit f84ae537 authored by Mikhail Naganov's avatar Mikhail Naganov
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
Change-Id: I70a8fc7fb710a7a288509af3f8a57d0695c53b1a
parent 914339da
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -502,13 +502,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;
        }