cppcheck: miniflann.cpp, resource leak (Bug #1658)


Added by Nghia Ho about 13 years ago. Updated almost 13 years ago.


Status:Done Start date:2012-03-08
Priority:Normal Due date:
Assignee:Marius Muja % Done:

100%

Category:flann
Target version:2.4.0
Affected version: Operating System:
Difficulty: HW Platform:
Pull request:

Description

cppcheck reports a resource leak at line 647 in miniflan.cpp because fclose(fout) is not called before the return, it should be

void Index::save(const std::string& filename) const {
FILE* fout = fopen(filename.c_str(), "wb");
if (fout NULL)
CV_Error_( CV_StsError, ("Can not open file %s for writing FLANN index\n", filename.c_str()) );

if( algo  FLANN_INDEX_LSH )
{
saveIndex_<LshIndex>(this, index, fout);
fclose(out) <---- fix
return;
}

Associated revisions

Revision 1e8b72f8
Added by Andrey Pavlenko over 11 years ago

Merge pull request #1658 from alalek:ocl_fixes

History

Updated by Marius Muja almost 14 years ago

This was fixed in r6757.

  • Status changed from Open to Done
  • % Done changed from 0 to 100

Updated by Andrey Kamaev almost 13 years ago

  • Target version set to 2.4.0

Also available in: Atom PDF