mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
Fix a heap-use-after-free
This commit is contained in:
parent
648452ca60
commit
7f8356e37e
|
@ -3639,6 +3639,12 @@ void CClient::RequestDDNetInfo()
|
|||
str_append(aUrl, aEscaped, sizeof(aUrl));
|
||||
}
|
||||
|
||||
if(m_pDDNetInfoTask)
|
||||
{
|
||||
m_pDDNetInfoTask->Abort();
|
||||
m_pDDNetInfoTask->Destroy();
|
||||
}
|
||||
|
||||
m_pDDNetInfoTask = Fetcher()->FetchFile(aUrl, "ddnet-info.json.tmp", IStorage::TYPE_SAVE, true, true);
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@ public:
|
|||
|
||||
void CFetchTask::Destroy()
|
||||
{
|
||||
if(m_State >= IFetchTask::STATE_DONE || m_State == IFetchTask::STATE_ERROR)
|
||||
if(m_Job.Status() == CJob::STATE_DONE)
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
@ -87,6 +87,8 @@ IFetchTask *CFetcher::FetchFile(const char *pUrl, const char *pDest, int Storage
|
|||
pTask->m_pUser = pUser;
|
||||
pTask->m_pfnCompCallback = pfnCompCb;
|
||||
pTask->m_pfnProgressCallback = pfnProgCb;
|
||||
pTask->m_UseDDNetCA = UseDDNetCA;
|
||||
pTask->m_CanTimeout = CanTimeout;
|
||||
|
||||
pTask->m_Abort = false;
|
||||
pTask->m_Destroy = false;
|
||||
|
|
Loading…
Reference in a new issue