Fixed mismatching allocation and deallocation

This commit is contained in:
Micke Prag 2012-01-31 16:21:06 +01:00
parent d260100d38
commit 670e5f1c72
3 changed files with 8 additions and 8 deletions

View file

@ -45,7 +45,7 @@ std::string ProtocolIkea::getStringForMethod(int method, unsigned char level, Co
intUnits = intUnits | ( 1<<(9-intUnit) );
} while ( (strToken = strtok(NULL, ",")) != NULL );
free(tempUnits);
delete[] tempUnits;
std::string strReturn = "STTTTTTª"; //Startcode, always like this;

View file

@ -76,8 +76,8 @@ int Settings::getDeviceId(int intDeviceIndex) const {
if (RegEnumKeyEx(hk, intDeviceIndex, (LPWSTR)Buff, &size, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) {
intReturn = _wtoi(Buff);
}
delete Buff;
delete[] Buff;
RegCloseKey(hk);
}
return intReturn;
@ -171,14 +171,14 @@ std::wstring Settings::getSetting(const std::wstring &strName) const{
if(lngStatus == ERROR_MORE_DATA){
//The buffer is to small, recreate it
delete Buff;
delete[] Buff;
Buff = new wchar_t[dwLength];
lngStatus = RegQueryValueEx(hk, strName.c_str(), NULL, NULL, (LPBYTE)Buff, &dwLength);
}
if (lngStatus == ERROR_SUCCESS) {
strReturn = Buff;
}
delete Buff;
delete[] Buff;
}
RegCloseKey(hk);
return strReturn;
@ -199,14 +199,14 @@ std::wstring Settings::getStringSetting(int intDeviceId, const std::wstring &nam
if(lngStatus == ERROR_MORE_DATA){
//The buffer is to small, recreate it
delete Buff;
delete[] Buff;
Buff = new wchar_t[dwLength];
lngStatus = RegQueryValueEx(hk, name.c_str(), NULL, NULL, (LPBYTE)Buff, &dwLength);
}
if (lngStatus == ERROR_SUCCESS) {
strReturn = Buff;
}
delete Buff;
delete[] Buff;
}
RegCloseKey(hk);
return strReturn;

View file

@ -68,7 +68,7 @@ TellStick::TellStick(int controllerId, TelldusCore::Event *event, const TellStic
#endif
Log::notice("Connecting to TellStick (%X/%X) with serial %s", d->vid, d->pid, d->serial.c_str());
FT_STATUS ftStatus = FT_OpenEx(tempSerial, FT_OPEN_BY_SERIAL_NUMBER, &d->ftHandle);
delete tempSerial;
delete[] tempSerial;
if (ftStatus == FT_OK) {
d->open = true;
FT_SetFlowControl(d->ftHandle, FT_FLOW_NONE, 0, 0);