summaryrefslogtreecommitdiff
path: root/plugins/TopToolBar
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-08 21:56:45 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-08 21:56:45 +0000
commit7e61d4900d9b99958f863cd2f56fc3cd4e800600 (patch)
tree2ea789738356137ee8bf0dac0634b4ce7d27c7b6 /plugins/TopToolBar
parent56984a95c2514df3a96849d790a3e1bc5b3de52a (diff)
memory crash fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@367 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/TopToolBar')
-rw-r--r--plugins/TopToolBar/main.cpp8
-rw-r--r--plugins/TopToolBar/ttbopt.cpp34
2 files changed, 24 insertions, 18 deletions
diff --git a/plugins/TopToolBar/main.cpp b/plugins/TopToolBar/main.cpp
index df441b85cb..18d6584e9e 100644
--- a/plugins/TopToolBar/main.cpp
+++ b/plugins/TopToolBar/main.cpp
@@ -137,14 +137,14 @@ int DBLoadButtonSettings(int butpos)
Buttons[butpos].dwFlags |= TTBBF_VISIBLE;
Buttons[butpos].UserDefinedbmDown = DBGetStringT(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpDown"));
- if ((Buttons[butpos].UserDefinedbmDown != NULL) && *Buttons[butpos].UserDefinedbmDown == 0) {
- free(Buttons[butpos].UserDefinedbmDown);
+ if ( Buttons[butpos].UserDefinedbmDown != NULL && Buttons[butpos].UserDefinedbmDown[0] == 0) {
+ mir_free(Buttons[butpos].UserDefinedbmDown);
Buttons[butpos].UserDefinedbmDown = NULL;
}
Buttons[butpos].UserDefinedbmUp = DBGetStringT(0, TTB_OPTDIR, AS(buf, Buttons[butpos].name, "_BmpUp"));
- if ((Buttons[butpos].UserDefinedbmUp != NULL) && *Buttons[butpos].UserDefinedbmUp == 0) {
- free(Buttons[butpos].UserDefinedbmUp);
+ if ( Buttons[butpos].UserDefinedbmUp != NULL && Buttons[butpos].UserDefinedbmUp[0] == 0) {
+ mir_free(Buttons[butpos].UserDefinedbmUp);
Buttons[butpos].UserDefinedbmUp = NULL;
}
return 0;
diff --git a/plugins/TopToolBar/ttbopt.cpp b/plugins/TopToolBar/ttbopt.cpp
index 6167f3e19e..fddfbe5e84 100644
--- a/plugins/TopToolBar/ttbopt.cpp
+++ b/plugins/TopToolBar/ttbopt.cpp
@@ -84,26 +84,30 @@ void AssignBitmapsFromDir(TCHAR *dir)
wsprintf(curnameDN, _T("%s%s_DN.bmp"), dir, ChangedName);
if ( FileExists(curnameUP)) {
- if (Buttons[i].UserDefinedbmUp != NULL){free(Buttons[i].UserDefinedbmUp);}
- Buttons[i].UserDefinedbmUp = _tcsdup(curnameUP);
+ if (Buttons[i].UserDefinedbmUp != NULL)
+ mir_free(Buttons[i].UserDefinedbmUp);
+ Buttons[i].UserDefinedbmUp = mir_tstrdup(curnameUP);
}
if ( FileExists(curnameDN)) {
- if (Buttons[i].UserDefinedbmDown != NULL){free(Buttons[i].UserDefinedbmDown);}
- Buttons[i].UserDefinedbmDown = _tcsdup(curnameDN);
+ if (Buttons[i].UserDefinedbmDown != NULL)
+ mir_free(Buttons[i].UserDefinedbmDown);
+ Buttons[i].UserDefinedbmDown = mir_tstrdup(curnameDN);
}
wsprintf(curnameUP, _T("%s%s_UP.ico"), dir, ChangedName);
wsprintf(curnameDN, _T("%s%s_DN.ico"), dir, ChangedName);
if ( FileExists(curnameUP)) {
- if (Buttons[i].UserDefinedbmUp != NULL){free(Buttons[i].UserDefinedbmUp);}
- Buttons[i].UserDefinedbmUp = _tcsdup(curnameUP);
+ if (Buttons[i].UserDefinedbmUp != NULL)
+ mir_free(Buttons[i].UserDefinedbmUp);
+ Buttons[i].UserDefinedbmUp = mir_tstrdup(curnameUP);
}
if ( FileExists(curnameDN)) {
- if (Buttons[i].UserDefinedbmDown != NULL){free(Buttons[i].UserDefinedbmDown);}
- Buttons[i].UserDefinedbmDown = _tcsdup(curnameDN);
+ if (Buttons[i].UserDefinedbmDown != NULL)
+ mir_free(Buttons[i].UserDefinedbmDown);
+ Buttons[i].UserDefinedbmDown = mir_tstrdup(curnameDN);
}
}
@@ -418,8 +422,8 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
int curselect = ((ButtonOptData *)tvi.lParam)->pos;
lockbut();
- if (Buttons[curselect].UserDefinedbmUp != NULL) free(Buttons[curselect].UserDefinedbmUp);
- if (Buttons[curselect].UserDefinedbmDown != NULL) free(Buttons[curselect].UserDefinedbmDown);
+ if (Buttons[curselect].UserDefinedbmUp != NULL) mir_free(Buttons[curselect].UserDefinedbmUp);
+ if (Buttons[curselect].UserDefinedbmDown != NULL) mir_free(Buttons[curselect].UserDefinedbmDown);
Buttons[curselect].UserDefinedbmUp = NULL;
Buttons[curselect].UserDefinedbmDown = NULL;
applyuserbitmaps(curselect);
@@ -476,12 +480,14 @@ static INT_PTR CALLBACK ButOrderOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPAR
if (GetOpenFileName(&ofn)) {
lockbut();
if (ctrlid == IDC_BMPUP){
- if (Buttons[curselect].UserDefinedbmUp != NULL){free(Buttons[curselect].UserDefinedbmUp);}
- Buttons[curselect].UserDefinedbmUp = _tcsdup(ofn.lpstrFile);
+ if (Buttons[curselect].UserDefinedbmUp != NULL)
+ mir_free(Buttons[curselect].UserDefinedbmUp);
+ Buttons[curselect].UserDefinedbmUp = mir_tstrdup(ofn.lpstrFile);
}
if (ctrlid == IDC_BMPDN){
- if (Buttons[curselect].UserDefinedbmDown != NULL){free(Buttons[curselect].UserDefinedbmDown);}
- Buttons[curselect].UserDefinedbmDown = _tcsdup(ofn.lpstrFile);
+ if (Buttons[curselect].UserDefinedbmDown != NULL)
+ mir_free(Buttons[curselect].UserDefinedbmDown);
+ Buttons[curselect].UserDefinedbmDown = mir_tstrdup(ofn.lpstrFile);
}
applyuserbitmaps(curselect);
SetImagesForCurrent(hwndDlg, curselect);