summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-09-25 10:26:59 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-09-25 10:26:59 +0000
commit8b4739502257314e0eae6f72f054f5af1cdb2c10 (patch)
treef45c6e7d3676a748b5f3bce581957399ed4f69ec /plugins
parentc04b71515237f66971de178e34c4228cf1d9ece2 (diff)
- fix for memory corruption in Dbx_tree
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@1648 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Db3x_mmap/src/dbcontacts.cpp5
-rw-r--r--plugins/Dbx_tree/DatabaseLink.cpp2
2 files changed, 3 insertions, 4 deletions
diff --git a/plugins/Db3x_mmap/src/dbcontacts.cpp b/plugins/Db3x_mmap/src/dbcontacts.cpp
index 3dc0260fa8..7dcbdc6206 100644
--- a/plugins/Db3x_mmap/src/dbcontacts.cpp
+++ b/plugins/Db3x_mmap/src/dbcontacts.cpp
@@ -70,13 +70,12 @@ STDMETHODIMP_(HANDLE) CDb3Base::FindFirstContact(const char *szProto)
STDMETHODIMP_(HANDLE) CDb3Base::FindNextContact(HANDLE hContact, const char *szProto)
{
- int index;
- DBContact *dbc;
DBCachedContactValueList VLtemp, *VL = NULL;
VLtemp.hContact = hContact;
mir_cslock lck(m_csDbAccess);
while (VLtemp.hContact) {
+ int index;
if (( index = m_lContacts.getIndex(&VLtemp)) != -1) {
VL = m_lContacts[index];
if (VL->hNext != NULL) {
@@ -87,7 +86,7 @@ STDMETHODIMP_(HANDLE) CDb3Base::FindNextContact(HANDLE hContact, const char *szP
continue;
} }
- dbc = (DBContact*)DBRead(VLtemp.hContact,sizeof(DBContact),NULL);
+ DBContact *dbc = (DBContact*)DBRead(VLtemp.hContact,sizeof(DBContact),NULL);
if (dbc->signature != DBCONTACT_SIGNATURE)
break;
diff --git a/plugins/Dbx_tree/DatabaseLink.cpp b/plugins/Dbx_tree/DatabaseLink.cpp
index 79c1758fca..cc944cc305 100644
--- a/plugins/Dbx_tree/DatabaseLink.cpp
+++ b/plugins/Dbx_tree/DatabaseLink.cpp
@@ -80,7 +80,7 @@ static int UnloadDatabase(MIDatabase* db)
{
if (gDataBase == db)
gDataBase = NULL;
- delete db;
+ delete (CDataBase*)db;
return 0;
}