diff options
author | George Hazan <george.hazan@gmail.com> | 2013-03-17 14:22:17 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2013-03-17 14:22:17 +0000 |
commit | 15267ea2d489606fb4b99d011bc3ea7c2a644a9f (patch) | |
tree | 607fb948632ec8b348508cbd08ef41fffe21d8c2 /plugins/Popup/src/notifications.cpp | |
parent | 5e6e1e8838fe7637ef588e0fb080ad07fc5700aa (diff) |
fix for popup-related memory leaks
git-svn-id: http://svn.miranda-ng.org/main/trunk@4077 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Popup/src/notifications.cpp')
-rw-r--r-- | plugins/Popup/src/notifications.cpp | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/plugins/Popup/src/notifications.cpp b/plugins/Popup/src/notifications.cpp index aa2a92338a..5c01266b9f 100644 --- a/plugins/Popup/src/notifications.cpp +++ b/plugins/Popup/src/notifications.cpp @@ -71,16 +71,21 @@ void LoadNotifications() g_hntfError = RegisterNotification(¬ification);
}
-void UnloadTreeData()
+void FreePopupClass(POPUPTREEDATA *ptd)
{
- for (int i=0; i < gTreeData.getCount(); ++i) {
- if (gTreeData[i]->typ == 2) {
- mir_free(gTreeData[i]->pupClass.pszName);
- mir_free(gTreeData[i]->pupClass.pszDescription);
- }
- mir_free(gTreeData[i]->pszTreeRoot);
- mir_free(gTreeData[i]->pszDescription);
+ if (ptd->typ == 2) {
+ mir_free(ptd->pupClass.pszName);
+ mir_free(ptd->pupClass.pszDescription);
}
+ mir_free(ptd->pszTreeRoot);
+ mir_free(ptd->pszDescription);
+ mir_free(ptd);
+}
+
+void UnloadTreeData()
+{
+ for (int i=0; i < gTreeData.getCount(); ++i)
+ FreePopupClass(gTreeData[i]);
gTreeData.destroy();
}
@@ -234,11 +239,12 @@ HANDLE RegisterNotification(POPUPNOTIFICATION *notification) HANDLE FindTreeData(LPTSTR group, LPTSTR name, BYTE typ)
{
for(int i=0; i < gTreeData.getCount(); i++) {
- if ( gTreeData[i]->typ == typ &&
- (!group || (_tcscmp(gTreeData[i]->pszTreeRoot, group) == 0)) &&
- (!name || (_tcscmp(gTreeData[i]->pszDescription, name) == 0)))
+ POPUPTREEDATA *p = gTreeData[i];
+ if (p->typ == typ &&
+ (!group || (_tcscmp(p->pszTreeRoot, group) == 0)) &&
+ (!name || (_tcscmp(p->pszDescription, name) == 0)))
{
- return gTreeData[i];
+ return p;
}
}
return NULL;
|