From 68fa3d953d9741dba28df0cd1b979904a59c1085 Mon Sep 17 00:00:00 2001 From: Tobias Weimer Date: Sat, 19 Mar 2016 09:23:58 +0000 Subject: UserInfoEx: - Fixed memory leak git-svn-id: http://svn.miranda-ng.org/main/trunk@16506 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/UserInfoEx/src/classPsTreeItem.cpp | 32 ++++++++++++++---------------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/plugins/UserInfoEx/src/classPsTreeItem.cpp b/plugins/UserInfoEx/src/classPsTreeItem.cpp index 57c488a0a1..05b88064ec 100644 --- a/plugins/UserInfoEx/src/classPsTreeItem.cpp +++ b/plugins/UserInfoEx/src/classPsTreeItem.cpp @@ -44,23 +44,19 @@ BOOL CALLBACK BoldGroupTitlesEnumChildren(HWND hWnd, LPARAM lParam) * odp - optiondialogpage structure with the info about the item to add * return: nothing **/ -CPsTreeItem::CPsTreeItem() +CPsTreeItem::CPsTreeItem() : _idDlg(NULL), _pTemplate(NULL), _hInst(NULL), _pfnDlgProc(NULL), _hWnd(NULL), _dwFlags(NULL), + _hItem(NULL), // handle to the treeview item + _iParent(-1), // index to the parent item + _iImage(-1), // index of treeview item's image + _bState(NULL), // initial state of this treeitem + _pszName(NULL), // original name, given by plugin (not customized) + _ptszLabel(NULL), + _pszProto(NULL), + _pszPrefix(NULL), + _hContact(NULL), + _iPosition(0), + _initParam(0) { - _idDlg = NULL; - _pTemplate = NULL; - _hInst = NULL; - _pfnDlgProc = NULL; - _hWnd = NULL; - _dwFlags = NULL; - _hItem = NULL; // handle to the treeview item - _iParent = -1; // index to the parent item - _iImage = -1; // index of treeview item's image - _bState = NULL; // initial state of this treeitem - _pszName = NULL; // original name, given by plugin (not customized) - _ptszLabel = NULL; - _pszProto = NULL; - _pszPrefix = NULL; - _hContact = NULL; } /** @@ -217,7 +213,9 @@ void CPsTreeItem::Rename(const LPTSTR pszLabel) if (pszLabel && *pszLabel) { LPTSTR pszDup = mir_tstrdup(pszLabel); if (pszDup) { - replaceStrT(_ptszLabel, pszDup); + if (_ptszLabel) + mir_free(_ptszLabel); + _ptszLabel = pszDup; // convert disallowed characters while(*pszDup) { switch(*pszDup) { -- cgit v1.2.3