CHECK that Deregister is called before destruction
We were getting use after frees because LogReader::Deregister wasn't
being called. Add a CHECK to catch this situation and enforce it.
Change-Id: Ic5009ac9a6710aa2b33d7f400a9a6b2b900b4098
diff --git a/aos/flatbuffers.h b/aos/flatbuffers.h
index 0a06e00..4aa0ff8 100644
--- a/aos/flatbuffers.h
+++ b/aos/flatbuffers.h
@@ -115,6 +115,10 @@
absl::Span<const uint8_t> span() const {
return absl::Span<const uint8_t>(data(), size());
}
+
+ // Wipes out the data buffer. This is handy to mark an instance as freed, and
+ // make attempts to use it fail more obviously.
+ void Wipe() { memset(data(), 0, size()); }
};
// String backed flatbuffer.