summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTobias Markmann <tm@ayena.de>2014-08-15 13:33:59 (GMT)
committerSwift Review <review@swift.im>2014-09-18 06:23:03 (GMT)
commitdbdd30aa0d94c79742a602908890548030088bc9 (patch)
tree1e80c718167538fabf39c340f2e4a4d43773910e /Swiften/Client/ClientBlockListManager.cpp
parentd33e0a18e51ce35b967398a7b6d22a26082de0e9 (diff)
downloadswift-contrib-dbdd30aa0d94c79742a602908890548030088bc9.zip
swift-contrib-dbdd30aa0d94c79742a602908890548030088bc9.tar.bz2
Only allocate BlockResponder and UnblockResponder once. Fixes ASAN
heap-used-after-free report. Tested via ASAN, report gone after applying this change. It previously occured during machine sleep/resume or logout/login. Change-Id: I8af6a3c290457a4a98f94486a225f9dfb92ca885 License: This patch is BSD-licensed, see Documentation/Licenses/BSD-simplified.txt for details.
Diffstat (limited to 'Swiften/Client/ClientBlockListManager.cpp')
-rw-r--r--Swiften/Client/ClientBlockListManager.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/Swiften/Client/ClientBlockListManager.cpp b/Swiften/Client/ClientBlockListManager.cpp
index d446315..de43631 100644
--- a/Swiften/Client/ClientBlockListManager.cpp
+++ b/Swiften/Client/ClientBlockListManager.cpp
@@ -126,9 +126,13 @@ void ClientBlockListManager::handleBlockListReceived(boost::shared_ptr<BlockList
blockList->setItems(payload->getItems());
blockList->setState(BlockList::Available);
+ if (!blockResponder) {
blockResponder = boost::make_shared<BlockResponder>(blockList, iqRouter);
blockResponder->start();
+ }
+ if (!unblockResponder) {
unblockResponder = boost::make_shared<UnblockResponder>(blockList, iqRouter);
unblockResponder->start();
}
}
+}