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

Commit 2d5e05b4 authored by Martijn Coenen's avatar Martijn Coenen
Browse files

Don't return a reference in FindQuotaDeviceForUuid.

Since the object could be destroyed after we return it.

Bug: 169421939
Test: N/A
Change-Id: Ib2f68f87b5e04d59f825b2b1f48de39ca007452f
parent e1a41049
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line Diff line number Diff line
@@ -35,7 +35,7 @@ std::recursive_mutex mMountsLock;
/* Map of all quota mounts from target to source */
/* Map of all quota mounts from target to source */
std::unordered_map<std::string, std::string> mQuotaReverseMounts;
std::unordered_map<std::string, std::string> mQuotaReverseMounts;


std::string& FindQuotaDeviceForUuid(const std::string& uuid) {
std::string FindQuotaDeviceForUuid(const std::string& uuid) {
    std::lock_guard<std::recursive_mutex> lock(mMountsLock);
    std::lock_guard<std::recursive_mutex> lock(mMountsLock);
    auto path = create_data_path(uuid.empty() ? nullptr : uuid.c_str());
    auto path = create_data_path(uuid.empty() ? nullptr : uuid.c_str());
    return mQuotaReverseMounts[path];
    return mQuotaReverseMounts[path];