QIICR / dcmqi

dcmqi (DICOM for Quantitative Imaging) is a free, open source C++ library for conversion between imaging research formats and the standard DICOM representation for image analysis results
https://qiicr.gitbook.io/dcmqi-guide/
BSD 3-Clause "New" or "Revised" License
232 stars 62 forks source link

Segmentation object not released after converting to ITK images #417

Closed lorteddie closed 3 years ago

lorteddie commented 3 years ago

ImageSEGConverter::dcmSegmentation2itkimage uses DCMTKs DcmSegmentation::loadDataset to parse the dataset into a segmentation object. The resulting object must be freed by the caller but never is, resulting in a memory leak.

Adding the line std::unique_ptr segdocguard(segdoc); fixes the issue.

fedorov commented 3 years ago

@lorteddie thanks for the report - would you like to submit a pull request with the suggested fix?

lorteddie commented 3 years ago

ok it took me a while but i think i managed. not sure how to link the pr to this ticket though

fedorov commented 3 years ago

@lorteddie thanks a lot for your contribution!

ok it took me a while but i think i managed. not sure how to link the pr to this ticket though

Next time, you could reference the ticket in the commit message like this #417, or you can also link issue to the ticket in the right-hand side ;-)

image

Thanks again!