diff options
author | George Hazan <ghazan@miranda.im> | 2017-03-31 12:34:45 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2017-03-31 12:34:45 +0300 |
commit | 7b5c945859e92b1921313da3bbd5dc332ac62910 (patch) | |
tree | 0d6cf893e76e3eee1bb913b7798e75695ae8d3cd | |
parent | cffe05b54d4ebed92421397015f949ecfa6d6764 (diff) |
couple of memleak fixes
-rw-r--r-- | plugins/Clist_modern/src/modern_clisttray.cpp | 21 | ||||
-rw-r--r-- | src/mir_core/src/subclass.cpp | 3 |
2 files changed, 14 insertions, 10 deletions
diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index 9f9f9a40af..14ce0aa1d1 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -411,7 +411,6 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) HICON hIcon = NULL;
int i = 0, iStatus;
- char *szProto;
switch (Mode) {
case TRAY_ICON_MODE_GLOBAL:
@@ -421,17 +420,19 @@ int cliTrayCalcChanged(const char *szChangedProto, int, int) case TRAY_ICON_MODE_ACC:
// В этом режиме показывается иконка совершенно определённого аккаунта, и не всегда это szChangedProto.
- szProto = db_get_sa(NULL, "CList", bDiffers ? "tiAccV" : "tiAccS");
- if (szProto == NULL)
- break;
+ {
+ ptrA szProto(db_get_sa(0, "CList", bDiffers ? "tiAccV" : "tiAccS"));
+ if (szProto == nullptr)
+ break;
- iStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
- if (g_StatusBarData.bConnectingIcon && IsStatusConnecting(iStatus))
- hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szProto, 0);
- else
- hIcon = pcli->pfnGetIconFromStatusMode(NULL, szProto, CallProtoService(szProto, PS_GETSTATUS, 0, 0));
+ iStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ if (g_StatusBarData.bConnectingIcon && IsStatusConnecting(iStatus))
+ hIcon = (HICON)CLUI_GetConnectingIconService((WPARAM)szProto, 0);
+ else
+ hIcon = pcli->pfnGetIconFromStatusMode(NULL, szProto, CallProtoService(szProto, PS_GETSTATUS, 0, 0));
- pcli->pfnTrayIconMakeTooltip(NULL, szProto);
+ pcli->pfnTrayIconMakeTooltip(NULL, szProto);
+ }
break;
case TRAY_ICON_MODE_CYCLE:
diff --git a/src/mir_core/src/subclass.cpp b/src/mir_core/src/subclass.cpp index f917646bb7..9188ad60aa 100644 --- a/src/mir_core/src/subclass.cpp +++ b/src/mir_core/src/subclass.cpp @@ -58,6 +58,9 @@ static LRESULT CALLBACK MSubclassWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LP MIR_CORE_DLL(void) mir_subclassWindow(HWND hWnd, WNDPROC wndProc)
{
+ if (hWnd == nullptr)
+ return;
+
MSubclassData *p = arSubclass.find((MSubclassData*)&hWnd);
if (p == NULL) {
p = new MSubclassData;
|