From b89b79d96fab7562a4cbd11c70df65bdf16b0a62 Mon Sep 17 00:00:00 2001 From: Sarang Masti Date: Thu, 28 May 2015 16:12:21 -0700 Subject: [PATCH] Fix asan test crashes Summary: We need to prevent the socket from being deleted while in the loopCallback. Test Plan: -- fbconfig '--sanitize' 'address' 'folly/io/async/test' && fbmake runtests Reviewed By: davejwatson@fb.com Subscribers: trunkagent, folly-diffs@, yfeldblum, chalfant FB internal diff: D2109031 Tasks: 7250307 Signature: t1:2109031:1432918801:77f0352254925d3f33f1e004c8bba89cde63e2cf Blame Revision: D2102601 --- folly/io/async/AsyncSocket.h | 1 + 1 file changed, 1 insertion(+) diff --git a/folly/io/async/AsyncSocket.h b/folly/io/async/AsyncSocket.h index 85d7275d..9e3a224b 100644 --- a/folly/io/async/AsyncSocket.h +++ b/folly/io/async/AsyncSocket.h @@ -556,6 +556,7 @@ class AsyncSocket : virtual public AsyncTransportWrapper { public: explicit ImmediateReadCB(AsyncSocket* socket) : socket_(socket) {} void runLoopCallback() noexcept override { + DestructorGuard dg(socket_); socket_->checkForImmediateRead(); } private: -- 2.34.1