summaryrefslogtreecommitdiff
path: root/plugins/Non-IM Contact/src/contactinfo.cpp
diff options
context:
space:
mode:
authorTobias Weimer <wishmaster51@googlemail.com>2015-01-24 20:20:56 +0000
committerTobias Weimer <wishmaster51@googlemail.com>2015-01-24 20:20:56 +0000
commit1b33fad341b6eae6f3f377e67b91ed81b845269a (patch)
treee3eb972e370b65811c8cb11ee09fb0701d38f81b /plugins/Non-IM Contact/src/contactinfo.cpp
parentf95c6ed55da24f45ea3cf15d3802d6ca686c16a2 (diff)
Non-IM-Contacts:
-Many memory issues fixed git-svn-id: http://svn.miranda-ng.org/main/trunk@11900 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Non-IM Contact/src/contactinfo.cpp')
-rw-r--r--plugins/Non-IM Contact/src/contactinfo.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/plugins/Non-IM Contact/src/contactinfo.cpp b/plugins/Non-IM Contact/src/contactinfo.cpp
index 137c9f1953..a14a5da846 100644
--- a/plugins/Non-IM Contact/src/contactinfo.cpp
+++ b/plugins/Non-IM Contact/src/contactinfo.cpp
@@ -317,14 +317,14 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
case IDC_DOIT:
if (GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE))) {
- char *replace = (char*)malloc(GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
char newString[MAX_REPLACES][512], oldString[MAX_REPLACES][512];
char dbVar1[2000], dbVar2[2000];
int i=0,j=0, k=0;
char *string = oldString[k];
MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), hContact2;
- GetDlgItemTextA(hwnd, IDC_STRING_REPLACE, replace, GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
if (db_get_static(hContact1, MODNAME, "Name", dbVar1)) {
+ char *replace = (char*)malloc(GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
+ GetDlgItemTextA(hwnd, IDC_STRING_REPLACE, replace, GetWindowTextLength(GetDlgItem(hwnd, IDC_STRING_REPLACE)) +1);
// get the list of replace strings
while (replace[i] != '\0') {
if (replace[i] == ',') {
@@ -334,7 +334,7 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
else if (!strncmp(&replace[i], "\r\n",2)) {
if (string == newString[k])
k--;
- if (k = MAX_REPLACES) break;
+ if (k == MAX_REPLACES) break;
string = oldString[++k];
i+=2;
continue;
@@ -399,9 +399,10 @@ INT_PTR CALLBACK DlgProcCopy(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
}
else {
char dbVar1[2000];
- MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA), hContact2;
+ MCONTACT hContact1 = (MCONTACT)GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (db_get_static(hContact1, MODNAME, "Name", dbVar1)) {
- if (!(hContact2 = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0))) {
+ MCONTACT hContact2 = (MCONTACT) CallService(MS_DB_CONTACT_ADD, 0, 0);
+ if (!hContact2) {
msg("contact did not get created","");
return 0;
}
@@ -615,6 +616,8 @@ INT_PTR ImportContacts(WPARAM wParam, LPARAM lParam)
mir_snprintf(tmp, SIZEOF(tmp), "Icon: On The Phone\r\n");
else if (icon == ID_STATUS_OUTTOLUNCH)
mir_snprintf(tmp, SIZEOF(tmp), "Icon: Out To Lunch\r\n");
+ else
+ continue;
msg = (char*)realloc(msg, strlen(msg) + strlen(tmp) +1);
strcat(msg,tmp);
}