From 36bae0cb914a64f5c9ce9a8e2b606b53cef7fd88 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 15 Jul 2023 20:53:18 +0300 Subject: memory leak fix --- protocols/Telegram/src/avatars.cpp | 1 - protocols/Telegram/src/proto.h | 6 +++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'protocols/Telegram') diff --git a/protocols/Telegram/src/avatars.cpp b/protocols/Telegram/src/avatars.cpp index de4d74f2ee..c5f60605ac 100644 --- a/protocols/Telegram/src/avatars.cpp +++ b/protocols/Telegram/src/avatars.cpp @@ -219,7 +219,6 @@ void CTelegramProto::ProcessFile(TD::updateFile *pObj) for (auto &it : m_arUsers) { if (it->szAvatarHash == pFile->remote_->unique_id_.c_str()) { - PROTO_AVATAR_INFORMATION pai; pai.hContact = it->hContact; pai.format = ProtoGetAvatarFileFormat(wszExistingFile); diff --git a/protocols/Telegram/src/proto.h b/protocols/Telegram/src/proto.h index e83ed8ae6d..4fefc25766 100644 --- a/protocols/Telegram/src/proto.h +++ b/protocols/Telegram/src/proto.h @@ -71,6 +71,10 @@ struct TG_FILE_REQUEST : public MZeroedObject m_uniqueId(_3) {} + ~TG_FILE_REQUEST() + { delete ofd; + } + void AutoDetectType(); Type m_type; @@ -78,7 +82,7 @@ struct TG_FILE_REQUEST : public MZeroedObject TD::int53 m_fileId, m_fileSize = 0; CMStringA m_uniqueId; CMStringW m_destPath, m_fileName, m_wszDescr; - OFDTHREAD *ofd; + OFDTHREAD *ofd = 0; }; struct TG_USER : public MZeroedObject -- cgit v1.2.3