summaryrefslogtreecommitdiff
path: root/audio/core/all-versions/default/StreamOut.cpp
diff options
context:
space:
mode:
authorSteven Moreland <smoreland@google.com>2021-04-13 20:14:16 +0000
committerSteven Moreland <smoreland@google.com>2021-04-16 18:36:09 +0000
commit7283cbe8cbb250fc42f0358d4ca4c94f3c32b344 (patch)
treedfa41e8b3b762c0d8f4178dee71977e479907bf4 /audio/core/all-versions/default/StreamOut.cpp
parent91a4fcb311be53d47fd91ec1153186708f44ef1e (diff)
audio HAL - fix UAFs
Bug: 185259758 Test: N/A Change-Id: I5ec70b098a00746108e10ab39e966607d78c84ae Merged-In: I5ec70b098a00746108e10ab39e966607d78c84ae (cherry picked from commit a8ac7cf706be7a77589070ea7c62f8e1b94ce316)
Diffstat (limited to 'audio/core/all-versions/default/StreamOut.cpp')
-rw-r--r--audio/core/all-versions/default/StreamOut.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/audio/core/all-versions/default/StreamOut.cpp b/audio/core/all-versions/default/StreamOut.cpp
index 82cc408e99..19f925ab4e 100644
--- a/audio/core/all-versions/default/StreamOut.cpp
+++ b/audio/core/all-versions/default/StreamOut.cpp
@@ -370,9 +370,9 @@ Return<void> StreamOut::prepareForWriting(uint32_t frameSize, uint32_t framesCou
}
// Create and launch the thread.
- auto tempWriteThread =
- std::make_unique<WriteThread>(&mStopWriteThread, mStream, tempCommandMQ.get(),
- tempDataMQ.get(), tempStatusMQ.get(), tempElfGroup.get());
+ sp<WriteThread> tempWriteThread =
+ new WriteThread(&mStopWriteThread, mStream, tempCommandMQ.get(), tempDataMQ.get(),
+ tempStatusMQ.get(), tempElfGroup.get());
if (!tempWriteThread->init()) {
ALOGW("failed to start writer thread: %s", strerror(-status));
sendError(Result::INVALID_ARGUMENTS);
@@ -388,7 +388,7 @@ Return<void> StreamOut::prepareForWriting(uint32_t frameSize, uint32_t framesCou
mCommandMQ = std::move(tempCommandMQ);
mDataMQ = std::move(tempDataMQ);
mStatusMQ = std::move(tempStatusMQ);
- mWriteThread = tempWriteThread.release();
+ mWriteThread = tempWriteThread;
mEfGroup = tempElfGroup.release();
threadInfo.pid = getpid();
threadInfo.tid = mWriteThread->getTid();