Clear Context in EventLoop at construction time
We were exposing uninitialized memory and hoping our users wouldn't try
to access it. This is an overly bold assumption.
Change-Id: I286fe5e932354581419059d128563c435b16071b
Signed-off-by: Austin Schuh <austin.schuh@bluerivertech.com>
diff --git a/aos/events/shm_event_loop.cc b/aos/events/shm_event_loop.cc
index 3c89a1c..b2502a7 100644
--- a/aos/events/shm_event_loop.cc
+++ b/aos/events/shm_event_loop.cc
@@ -227,6 +227,7 @@
name_(FLAGS_application_name),
node_(MaybeMyNode(configuration)) {
CHECK(IsInitialized()) << ": Need to initialize AOS first.";
+ ClearContext();
if (configuration->has_nodes()) {
CHECK(node_ != nullptr) << ": Couldn't find node in config.";
}
@@ -1185,6 +1186,7 @@
// the event loop so the book keeping matches. Do this in the thread that
// created the timing reporter.
timing_report_sender_.reset();
+ ClearContext();
}
void ShmEventLoop::Exit() { epoll_.Quit(); }