copc-lib icon indicating copy to clipboard operation
copc-lib copied to clipboard

memory leak in copc::FileReader

Open Haojia521 opened this issue 2 years ago • 1 comments

The constructor of copc::FileReader calls initialization functions which may throw an exception. When an exception is thrown, the construction of the copc::FileReader object is interrupted and its deconstructor will not be called. Thus, the memory of std::fstream object 'f_stream' leaks.

Haojia521 avatar Dec 29 '22 08:12 Haojia521

@Haojia521 thanks for the report! Looks like some refactoring will be needed since we raise exceptions in a few methods called by constructors.

CCInc avatar Jan 23 '23 16:01 CCInc