Sanitize MDnsSdListener::Element::mRef.
The constructor of Element omits to clear mRef, and allocateServiceRef() links it into the list in this half-initialized state. Given the current code structure, this is harmless because we never de-reference mRef until it's finally initialized, but it wasn't immediately obvious and it's one tiny change away from becoming a nasty memory corruption bug. So let's just clear it for peace of mind, especially since we don't have asan on our side :-) Also made the destructor non-virtual, since Element isn't used polymorphically. Test: m netd (for lack of better test coverage) Change-Id: I6e65280ebb5cea80a0fea443d156f2e2e49ebd11
Loading
Please register or sign in to comment