Fixes of some memory leaks

This commit is contained in:
Piotr Miecielica
2013-11-19 17:35:27 +01:00
parent e69d2c1bb1
commit 923698d700
6 changed files with 18 additions and 5 deletions

View File

@@ -2619,8 +2619,10 @@ void HOGDescriptor::readALTModel(std::string modelfile)
double *linearwt = new double[totwords+1];
int length = totwords;
nread = fread(linearwt, sizeof(double), totwords + 1, modelfl);
if(nread != static_cast<size_t>(length) + 1)
if(nread != static_cast<size_t>(length) + 1) {
delete [] linearwt;
throw Exception();
}
for(int i = 0; i < length; i++)
detector.push_back((float)linearwt[i]);