diff options
Diffstat (limited to 'src/mir_core/db.cpp')
-rw-r--r-- | src/mir_core/db.cpp | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/mir_core/db.cpp b/src/mir_core/db.cpp index 6b066e1af8..7d6491c1e0 100644 --- a/src/mir_core/db.cpp +++ b/src/mir_core/db.cpp @@ -36,12 +36,14 @@ MIR_CORE_DLL(int) db_get_b(HANDLE hContact, const char *szModule, const char *sz cgs.szModule = szModule;
cgs.szSetting = szSetting;
cgs.pValue = &dbv;
- if ( !currDb->GetContactSetting(hContact, &cgs))
+ if ( !currDb->GetContactSetting(hContact, &cgs)) {
switch(dbv.type) {
case DBVT_BYTE: return dbv.bVal;
case DBVT_WORD: return BYTE(dbv.wVal);
case DBVT_DWORD: return BYTE(dbv.dVal);
}
+ currDb->FreeVariant(&dbv);
+ }
}
return errorValue;
}
@@ -54,12 +56,14 @@ MIR_CORE_DLL(int) db_get_w(HANDLE hContact, const char *szModule, const char *sz cgs.szModule = szModule;
cgs.szSetting = szSetting;
cgs.pValue = &dbv;
- if ( !currDb->GetContactSetting(hContact, &cgs))
+ if ( !currDb->GetContactSetting(hContact, &cgs)) {
switch(dbv.type) {
case DBVT_BYTE: return dbv.bVal;
case DBVT_WORD: return dbv.wVal;
case DBVT_DWORD: return WORD(dbv.dVal);
}
+ currDb->FreeVariant(&dbv);
+ }
}
return errorValue;
}
@@ -72,12 +76,15 @@ MIR_CORE_DLL(DWORD) db_get_dw(HANDLE hContact, const char *szModule, const char cgs.szModule = szModule;
cgs.szSetting = szSetting;
cgs.pValue = &dbv;
- if ( !currDb->GetContactSetting(hContact, &cgs))
+ if ( !currDb->GetContactSetting(hContact, &cgs)) {
switch(dbv.type) {
case DBVT_BYTE: return dbv.bVal;
case DBVT_WORD: return dbv.wVal;
case DBVT_DWORD: return dbv.dVal;
+ default: currDb->FreeVariant(&dbv);
}
+ currDb->FreeVariant(&dbv);
+ }
}
return errorValue;
|