HomePhabricator
Diffusion MITK ff67313f67ba

COMP: Fixed subtle memory management bug in pic file reader.

Description

COMP: Fixed subtle memory management bug in pic file reader.

Memory was allocated by ipPicGet via malloc() but freed in MITK via
delete[] which led to segfaults on certain systems. Further, it seems
that filling the MITK image memory with the ipPicDescriptor memory
worked just by coincidence, because the mitk::Image::GetData() method
allocates a memory block via new[] which was given to a ipPicDescriptor
as a void* and subsequently deleted in ipPicClear (called from
ipPicGet). However, the ipPicGet method then malloc's a memory block
of the same size which seemed to be allocated at the same address as
the block returned via mitk::Image::GetData() thus having the mitk::Image
point to a valid memory address (by coincidence) and later freeing it
with a wrong delete[] call.

Details

Provenance
zelzerAuthored on Feb 10 2015, 2:33 AM
Parents
rMITKb1d983f7f14c: COMP: Fixed external proj dependency handling and removed unnecessary
Branches
Unknown
Tags
Unknown