From 32bd6f652603f9248c37eecf3fe0a6e399861a34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20M=C3=BCller?= Date: Thu, 16 Nov 2023 21:33:10 +0100 Subject: [PATCH] Fix leak of community icons when jobs not finished The community icon data loaded in background jobs was previously not freed when the client is quit before the community icon data is processed. --- src/game/client/components/menus.h | 1 + src/game/client/components/menus_browser.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/src/game/client/components/menus.h b/src/game/client/components/menus.h index 8587d0bba..af17e5f6e 100644 --- a/src/game/client/components/menus.h +++ b/src/game/client/components/menus.h @@ -520,6 +520,7 @@ protected: SHA256_DIGEST m_Sha256; CAbstractCommunityIconJob(CMenus *pMenus, const char *pCommunityId, int StorageType); + virtual ~CAbstractCommunityIconJob(); public: const char *CommunityId() const { return m_aCommunityId; } diff --git a/src/game/client/components/menus_browser.cpp b/src/game/client/components/menus_browser.cpp index 6f75c58dc..6636e66f1 100644 --- a/src/game/client/components/menus_browser.cpp +++ b/src/game/client/components/menus_browser.cpp @@ -1799,6 +1799,12 @@ CMenus::CAbstractCommunityIconJob::CAbstractCommunityIconJob(CMenus *pMenus, con str_format(m_aPath, sizeof(m_aPath), "communityicons/%s.png", pCommunityId); } +CMenus::CAbstractCommunityIconJob::~CAbstractCommunityIconJob() +{ + free(m_ImageInfo.m_pData); + m_ImageInfo.m_pData = nullptr; +} + int CMenus::CCommunityIconDownloadJob::OnCompletion(int State) { State = CHttpRequest::OnCompletion(State);