summaryrefslogtreecommitdiff
path: root/plugins/CrashDumper
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-11-29 13:57:25 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-11-29 13:57:25 +0000
commit63611a72e967abd262e35d8683d9e14126accd68 (patch)
tree398412eefc67e1130f843c632c35ad4dd179240b /plugins/CrashDumper
parent4179a4030f3adf14c82c538f79c50ae041e37514 (diff)
memory allocation fix
git-svn-id: http://svn.miranda-ng.org/main/trunk@11149 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CrashDumper')
-rw-r--r--plugins/CrashDumper/src/crshdmp.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp
index 53a0a5a389..ccc560205a 100644
--- a/plugins/CrashDumper/src/crshdmp.cpp
+++ b/plugins/CrashDumper/src/crshdmp.cpp
@@ -158,21 +158,23 @@ INT_PTR OpenUrl(WPARAM wParam, LPARAM)
INT_PTR CopyLinkToClipboard(WPARAM, LPARAM)
{
- TCHAR *tmp;
- TCHAR buffer[MAX_PATH];
-
- tmp = db_get_wsa(NULL, PluginName, "Username");
- mir_sntprintf(buffer, SIZEOF(buffer), _T("http://vi.miranda-ng.org/detail/%s"), tmp);
- int bufLen = (sizeof(buffer) + 1) * sizeof(TCHAR);
- HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, bufLen);
- LPSTR buf = (LPSTR)GlobalLock(hData);
- memcpy(buf, buffer, bufLen);
-
- OpenClipboard(NULL);
- EmptyClipboard();
-
- SetClipboardData(CF_UNICODETEXT, hData);
- CloseClipboard();
+ ptrT tmp(db_get_wsa(NULL, PluginName, "Username"));
+ if (tmp != NULL) {
+ TCHAR buffer[MAX_PATH];
+ mir_sntprintf(buffer, SIZEOF(buffer), _T("http://vi.miranda-ng.org/detail/%s"), tmp);
+
+ int bufLen = (sizeof(buffer) + 1) * sizeof(TCHAR);
+ HANDLE hData = GlobalAlloc(GMEM_MOVEABLE, bufLen);
+ LPSTR buf = (LPSTR)GlobalLock(hData);
+ memcpy(buf, buffer, bufLen);
+
+ OpenClipboard(NULL);
+ EmptyClipboard();
+
+ if (SetClipboardData(CF_UNICODETEXT, hData) == NULL)
+ GlobalFree(hData);
+ CloseClipboard();
+ }
return 0;
}