summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-04-14 14:11:54 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-04-14 14:11:54 +0000
commit3c7325b96e3cf01f0fb4d007bbd4bc6f2ca8f6a9 (patch)
tree8b78675e7c7882637e9d3702f0cec405f65b9595 /plugins
parentc4c87a92cf7006b064196abb4e4a5a084924622f (diff)
potentional memleak fixed
git-svn-id: http://svn.miranda-ng.org/main/trunk@12811 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Clist_nicer/src/extBackg.cpp26
1 files changed, 14 insertions, 12 deletions
diff --git a/plugins/Clist_nicer/src/extBackg.cpp b/plugins/Clist_nicer/src/extBackg.cpp
index b43cececcd..400376d435 100644
--- a/plugins/Clist_nicer/src/extBackg.cpp
+++ b/plugins/Clist_nicer/src/extBackg.cpp
@@ -861,14 +861,18 @@ done_with_glyph:
if (!(tmpItem.dwFlags & IMAGE_GLYPH))
IMG_CreateItem(&tmpItem, szFinalName, hdc);
if (tmpItem.hbm || tmpItem.dwFlags & IMAGE_GLYPH) {
- COLORREF clr;
-
newItem = reinterpret_cast<ImageItem *>(malloc(sizeof(ImageItem)));
memset(newItem, 0, sizeof(ImageItem));
*newItem = tmpItem;
+
+ if (g_CLUIImageItem) {
+ IMG_DeleteItem(g_CLUIImageItem);
+ free(g_CLUIImageItem);
+ }
g_CLUIImageItem = newItem;
+
GetPrivateProfileStringA(itemname, "Colorkey", "e5e5e5", buffer, 500, szFileName);
- clr = HexStringToLong(buffer);
+ COLORREF clr = HexStringToLong(buffer);
cfg::dat.colorkey = clr;
cfg::writeDword("CLUI", "ColorKey", clr);
if (g_CLUISkinnedBkColor)
@@ -1220,7 +1224,9 @@ void IMG_LoadItems()
void LoadPerContactSkins(TCHAR *tszFileName)
{
char szItem[100];
- char *szSections = reinterpret_cast<char *>(malloc(3002));
+ ptrA szSections(LPSTR(calloc(3002, 1)));
+ char *p = szSections;
+
StatusItems_t *items = NULL, *this_item;
int i = 1;
@@ -1229,11 +1235,9 @@ void LoadPerContactSkins(TCHAR *tszFileName)
file[MAX_PATH - 1] = 0;
ReadItem(&default_item, "%Default", file);
- memset(szSections, 0, 3000);
- char *p = szSections;
GetPrivateProfileSectionNamesA(szSections, 3000, file);
szSections[3001] = szSections[3000] = 0;
- p = szSections;
+
while (mir_strlen(p) > 1) {
if (p[0] == '%') {
p += (mir_strlen(p) + 1);
@@ -1265,7 +1269,7 @@ void LoadPerContactSkins(TCHAR *tszFileName)
if ((INT_PTR)uid != CALLSERVICE_NOTFOUND && uid != NULL) {
DBVARIANT dbv = {0};
if (db_get(hContact, szProto, uid, &dbv))
- return;
+ break;
char UIN[40];
switch (dbv.type) {
@@ -1306,15 +1310,13 @@ void LoadPerContactSkins(TCHAR *tszFileName)
break;
}
}
- if (j == i - 1) { // disable the db copy if it has been disabled in the skin .ini file
+ if (j == i - 1) // disable the db copy if it has been disabled in the skin .ini file
if (cfg::getByte(hContact, "EXTBK", "VALID", 0))
cfg::writeByte(hContact, "EXTBK", "VALID", 0);
- }
}
}
+ free(items);
}
- free(szSections);
- free(items);
}
void extbk_import(char *file, HWND hwndDlg)