From 7d4ed0164a32a3667fb3786fb538fc083153883a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 24 May 2021 18:19:31 +0300 Subject: AVS: fix for memory corruption --- plugins/AVS/src/options.cpp | 2 +- plugins/AVS/src/stdafx.h | 7 ++----- plugins/AVS/src/utils.cpp | 8 ++++++++ plugins/AVS/src/version.h | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) (limited to 'plugins/AVS/src') diff --git a/plugins/AVS/src/options.cpp b/plugins/AVS/src/options.cpp index 2353e978fe..4a22874456 100644 --- a/plugins/AVS/src/options.cpp +++ b/plugins/AVS/src/options.cpp @@ -346,7 +346,7 @@ static INT_PTR CALLBACK DlgProcOptionsProtos(HWND hwndDlg, UINT msg, WPARAM wPar AVATARDRAWREQUEST avdrq = { 0 }; avdrq.hTargetDC = dis->hDC; avdrq.dwFlags |= AVDRQ_PROTOPICT; - avdrq.szProto = (g_selectedProto) ? g_selectedProto->szProtoname.get() : nullptr; + avdrq.szProto = (g_selectedProto) ? g_selectedProto->szProtoname : nullptr; GetClientRect(GetDlgItem(hwndDlg, IDC_PROTOPIC), &avdrq.rcDraw); CallService(MS_AV_DRAWAVATAR, 0, (LPARAM)&avdrq); } diff --git a/plugins/AVS/src/stdafx.h b/plugins/AVS/src/stdafx.h index b698cbf861..6372bd24ae 100644 --- a/plugins/AVS/src/stdafx.h +++ b/plugins/AVS/src/stdafx.h @@ -94,15 +94,12 @@ struct CacheNode : public AVATARCACHEENTRY, public MZeroedObject struct protoPicCacheEntry : public AVATARCACHEENTRY, public MZeroedObject { - protoPicCacheEntry(int _type, const char *_szName) : - cacheType(_type), - szProtoname(mir_strdup(_szName)) - {} + protoPicCacheEntry(int _type, const char *_szName); ~protoPicCacheEntry(); void clear(); - ptrA szProtoname; + char *szProtoname; int cacheType; union { PROTOCOLDESCRIPTOR *pd = 0; diff --git a/plugins/AVS/src/utils.cpp b/plugins/AVS/src/utils.cpp index 67f77e3a90..121fe9ea3d 100644 --- a/plugins/AVS/src/utils.cpp +++ b/plugins/AVS/src/utils.cpp @@ -266,8 +266,16 @@ int GetFileHash(wchar_t *filename) /////////////////////////////////////////////////////////////////////////////////////////////////// +protoPicCacheEntry::protoPicCacheEntry(int _type, const char *_szName) : + cacheType(_type), + szProtoname(mir_strdup(_szName)) +{ +} + protoPicCacheEntry::~protoPicCacheEntry() { + mir_free(szProtoname); + if (hbmPic != nullptr) DeleteObject(hbmPic); } diff --git a/plugins/AVS/src/version.h b/plugins/AVS/src/version.h index 78441f5461..eb064c91a5 100644 --- a/plugins/AVS/src/version.h +++ b/plugins/AVS/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 98 #define __RELEASE_NUM 1 -#define __BUILD_NUM 2 +#define __BUILD_NUM 3 #include -- cgit v1.2.3