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
parentd33e0a18e51ce35b967398a7b6d22a26082de0e9 (diff)
downloadswift-dbdd30aa0d94c79742a602908890548030088bc9.zip
swift-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')
-rw-r--r--Swiften/Client/ClientBlockListManager.cpp12
1 files changed, 8 insertions, 4 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
@@ -125,10 +125,14 @@ void ClientBlockListManager::handleBlockListReceived(boost::shared_ptr<BlockList
else {
blockList->setItems(payload->getItems());
blockList->setState(BlockList::Available);
- blockResponder = boost::make_shared<BlockResponder>(blockList, iqRouter);
- blockResponder->start();
- unblockResponder = boost::make_shared<UnblockResponder>(blockList, iqRouter);
- unblockResponder->start();
+ if (!blockResponder) {
+ blockResponder = boost::make_shared<BlockResponder>(blockList, iqRouter);
+ blockResponder->start();
+ }
+ if (!unblockResponder) {
+ unblockResponder = boost::make_shared<UnblockResponder>(blockList, iqRouter);
+ unblockResponder->start();
+ }
}
}