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

Commit c42403d3 authored by George Burgess IV's avatar George Burgess IV
Browse files

libmediadrm: fix a use of an uninit value

INIT_CHECK() expands to `if (foo) return bar;`, and `EventTimer`'s
destructor uses a value that's only set if `SetAttribute` is called.
This CL flips the INIT_CHECK/EventTimer lines to match getKeyRequest.

Caught by clang's static analyzer:
frameworks/av/include/media/EventMetric.h:155:7: warning: 2nd function
call argument is an uninitialized value
[clang-analyzer-core.CallAndMessage]

Bug: None
Test: TreeHugger
Change-Id: Ie0c4fb8c99a56082e234475e539c2ec4bc8fd948
parent 342d7bcf
Loading
Loading
Loading
Loading
+1 −2
Original line number Original line Diff line number Diff line
@@ -895,9 +895,8 @@ status_t DrmHal::getKeyRequest(Vector<uint8_t> const &sessionId,
status_t DrmHal::provideKeyResponse(Vector<uint8_t> const &sessionId,
status_t DrmHal::provideKeyResponse(Vector<uint8_t> const &sessionId,
        Vector<uint8_t> const &response, Vector<uint8_t> &keySetId) {
        Vector<uint8_t> const &response, Vector<uint8_t> &keySetId) {
    Mutex::Autolock autoLock(mLock);
    Mutex::Autolock autoLock(mLock);
    EventTimer<status_t> keyResponseTimer(&mMetrics.mProvideKeyResponseTimeUs);

    INIT_CHECK();
    INIT_CHECK();
    EventTimer<status_t> keyResponseTimer(&mMetrics.mProvideKeyResponseTimeUs);


    DrmSessionManager::Instance()->useSession(sessionId);
    DrmSessionManager::Instance()->useSession(sessionId);