logd: add locks around ~SerializedFlushToState
This accesses shared resources in SerializedLogBuffer and therefore
requires a lock.
Bug: 169736426
Test: malloc_debug_system_tests
Change-Id: I807c65f4719481f933b4917a50f83f933b1929fb
diff --git a/logd/LogReaderThread.h b/logd/LogReaderThread.h
index 20624f2..f1b673f 100644
--- a/logd/LogReaderThread.h
+++ b/logd/LogReaderThread.h
@@ -53,7 +53,7 @@
bool IsWatching(log_id_t id) const { return flush_to_state_->log_mask() & (1 << id); }
bool IsWatchingMultiple(LogMask log_mask) const {
- return flush_to_state_->log_mask() & log_mask;
+ return flush_to_state_ && flush_to_state_->log_mask() & log_mask;
}
std::string name() const { return writer_->name(); }