Fixed minor memory leak.

This commit is contained in:
hiker 2015-08-01 22:02:00 +10:00
parent 78c592e4e5
commit 2f902f769d

View File

@ -331,12 +331,15 @@ void AddonsLoading::stopDownload()
// (and not uninstalling an installed one):
if(m_download_request)
{
// In case of a cancel we can't free the memory, since
// network_http will potentially update the request. So in
// order to avoid a memory leak, we let network_http free
// the request.
//m_download_request->setManageMemory(true);
// In case of a cancel we can't free the memory, since the
// request manager thread is potentially working on this request. So
// in order to avoid a memory leak, we let the request manager
// free the data. This is thread safe since freeing the data is done
// when the request manager handles the result queue - and this is
// done by the main thread (i.e. this thread).
m_download_request->setManageMemory(true);
m_download_request->cancel();
m_download_request = NULL;
};
} // startDownload