Fixed various memory leaks as reported by AddressSanitizer
This commit is contained in:
@@ -361,6 +361,11 @@ SSEFUNCTION void LCPMapper::processVignetteLine3Channels(int width, int y, float
|
||||
|
||||
LCPProfile::LCPProfile(const Glib::ustring &fname)
|
||||
{
|
||||
for (int i = 0; i < MaxPersModelCount; i++) {
|
||||
aPersModel[i] = nullptr;
|
||||
}
|
||||
pCurPersModel = nullptr;
|
||||
|
||||
const int BufferSize = 8192;
|
||||
char buf[BufferSize];
|
||||
|
||||
@@ -378,10 +383,6 @@ LCPProfile::LCPProfile(const Glib::ustring &fname)
|
||||
isFisheye = inCamProfiles = firstLIDone = inPerspect = inAlternateLensID = inAlternateLensNames = false;
|
||||
sensorFormatFactor = 1;
|
||||
|
||||
for (int i = 0; i < MaxPersModelCount; i++) {
|
||||
aPersModel[i] = nullptr;
|
||||
}
|
||||
|
||||
persModelCount = 0;
|
||||
*inInvalidTag = 0;
|
||||
|
||||
@@ -412,6 +413,19 @@ LCPProfile::LCPProfile(const Glib::ustring &fname)
|
||||
filterBadFrames(1.5, 100);
|
||||
}
|
||||
|
||||
|
||||
LCPProfile::~LCPProfile()
|
||||
{
|
||||
if (pCurPersModel) {
|
||||
delete pCurPersModel;
|
||||
}
|
||||
for (int i = 0; i < MaxPersModelCount; i++) {
|
||||
if (aPersModel[i]) {
|
||||
delete aPersModel[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// from all frames not marked as bad already, take average and filter out frames with higher deviation than this if there are enough values
|
||||
int LCPProfile::filterBadFrames(double maxAvgDevFac, int minFramesLeft)
|
||||
{
|
||||
@@ -886,6 +900,15 @@ LCPStore* LCPStore::getInstance()
|
||||
return &instance_;
|
||||
}
|
||||
|
||||
|
||||
LCPStore::~LCPStore()
|
||||
{
|
||||
for (auto &p : profileCache) {
|
||||
delete p.second;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
LCPProfile* LCPStore::getProfile (Glib::ustring filename)
|
||||
{
|
||||
if (filename.length() == 0 || !isValidLCPFileName(filename)) {
|
||||
|
Reference in New Issue
Block a user