Skip to content

Commit 83e931f

Browse files
committed
Fix new clang -Wthread-safety-analysis warnings
Returning a reference to a GUARDED_BY variable while only holding the lock in the getter lets callers access the variable without holding the lock. See llvm/llvm-project#67776. This is only used for testing, so just return a copy for simplicity.
1 parent d0a4347 commit 83e931f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/core/lib/security/security_connector/tls/tls_security_connector.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,12 +205,12 @@ class TlsServerSecurityConnector final : public grpc_server_security_connector {
205205
return server_handshaker_factory_;
206206
};
207207

208-
const absl::optional<absl::string_view>& RootCertsForTesting() {
208+
const absl::optional<absl::string_view> RootCertsForTesting() {
209209
MutexLock lock(&mu_);
210210
return pem_root_certs_;
211211
}
212212

213-
const absl::optional<PemKeyCertPairList>& KeyCertPairListForTesting() {
213+
const absl::optional<PemKeyCertPairList> KeyCertPairListForTesting() {
214214
MutexLock lock(&mu_);
215215
return pem_key_cert_pair_list_;
216216
}

0 commit comments

Comments
 (0)