From: Sarang Masti Date: Thu, 28 May 2015 23:12:21 +0000 (-0700) Subject: Fix asan test crashes X-Git-Tag: v0.42.0~13 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=b89b79d96fab7562a4cbd11c70df65bdf16b0a62;p=folly.git 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 --- 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: