From 2d5e05b44248e445af986ca8410c6e98c6ba3533 Mon Sep 17 00:00:00 2001 From: Martijn Coenen Date: Thu, 26 Nov 2020 12:12:45 +0100 Subject: 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 --- cmds/installd/QuotaUtils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmds/installd/QuotaUtils.cpp b/cmds/installd/QuotaUtils.cpp index e0802911ca..60271392e9 100644 --- a/cmds/installd/QuotaUtils.cpp +++ b/cmds/installd/QuotaUtils.cpp @@ -35,7 +35,7 @@ std::recursive_mutex mMountsLock; /* Map of all quota mounts from target to source */ std::unordered_map mQuotaReverseMounts; -std::string& FindQuotaDeviceForUuid(const std::string& uuid) { +std::string FindQuotaDeviceForUuid(const std::string& uuid) { std::lock_guard lock(mMountsLock); auto path = create_data_path(uuid.empty() ? nullptr : uuid.c_str()); return mQuotaReverseMounts[path]; -- cgit v1.2.3-59-g8ed1b