Memory Leak in Drive Scanning
This commit is contained in:
@ -326,28 +326,28 @@ void reHDD::searchDrives(std::list<Drive> *plistDrives)
|
||||
if (devName.empty())
|
||||
continue;
|
||||
|
||||
Drive *tmpDrive = new Drive("/dev/" + devName);
|
||||
tmpDrive->state = Drive::NONE;
|
||||
tmpDrive->bIsOffline = false;
|
||||
Drive tmpDrive("/dev/" + devName);
|
||||
tmpDrive.state = Drive::NONE;
|
||||
tmpDrive.bIsOffline = false;
|
||||
|
||||
// Set connection type
|
||||
if (transport == "sata")
|
||||
tmpDrive->connectionType = Drive::SATA;
|
||||
tmpDrive.connectionType = Drive::SATA;
|
||||
else if (transport == "usb")
|
||||
tmpDrive->connectionType = Drive::USB;
|
||||
tmpDrive.connectionType = Drive::USB;
|
||||
else if (transport == "nvme")
|
||||
tmpDrive->connectionType = Drive::NVME;
|
||||
tmpDrive.connectionType = Drive::NVME;
|
||||
else
|
||||
tmpDrive->connectionType = Drive::UNKNOWN;
|
||||
tmpDrive.connectionType = Drive::UNKNOWN;
|
||||
|
||||
plistDrives->push_back(*tmpDrive);
|
||||
plistDrives->push_back(tmpDrive);
|
||||
|
||||
Logger::logThis()->info(
|
||||
"Drive found: " + tmpDrive->getPath() +
|
||||
"Drive found: " + tmpDrive.getPath() +
|
||||
" (type: " +
|
||||
(tmpDrive->connectionType == Drive::USB ? "USB" : tmpDrive->connectionType == Drive::SATA ? "SATA"
|
||||
: tmpDrive->connectionType == Drive::NVME ? "NVME"
|
||||
: "UNKNOWN") +
|
||||
(tmpDrive.connectionType == Drive::USB ? "USB" : tmpDrive.connectionType == Drive::SATA ? "SATA"
|
||||
: tmpDrive.connectionType == Drive::NVME ? "NVME"
|
||||
: "UNKNOWN") +
|
||||
")");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user