From bc41379bdb1ea19757914f45743ed97c999ce9e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= Date: Wed, 3 Jun 2009 19:09:04 +0200 Subject: Fix memory leak when receiving an error response on a request. diff --git a/Swiften/Queries/Request.cpp b/Swiften/Queries/Request.cpp index ac361cc..609d67b 100644 --- a/Swiften/Queries/Request.cpp +++ b/Swiften/Queries/Request.cpp @@ -17,23 +17,21 @@ void Request::send() { } bool Request::handleIQ(boost::shared_ptr iq) { + bool handled = false; if (iq->getID() == id_) { if (iq->getType() == IQ::Result) { handleResponse(iq->getPayloadOfSameType(payload_), boost::optional()); - if (autoDeleteBehavior_ == AutoDeleteAfterResponse) { - MainEventLoop::deleteLater(this); - } - return true; } else { // FIXME: Get proper error handleResponse(boost::shared_ptr(), boost::optional(Error::UndefinedCondition)); - return true; } + if (autoDeleteBehavior_ == AutoDeleteAfterResponse) { + MainEventLoop::deleteLater(this); + } + handled = true; } - else { - return false; - } + return handled; } } -- cgit v0.10.2-6-g49f6