[Dcmlib] Re: ptotential memory leak without virtual destructor.
Mathieu Malaterre
mathieu.malaterre at kitware.com
Mon Nov 15 16:31:26 CET 2004
> Mathieu,
>
> Does it fail with all the images from gdcmData or only with few of them
> ? I'm just suggesting that the problem can come from a buffer overrun
> somewhere in PixelConvert when for an image PixelDataLength >
> DecompressedSize...
>
> I'll try to revert the delete in the destructor and see what purify finds.
No I found the bug.
The way it is done (which I still hate more than ever) is:
gdcmHeader *h
gdcmFile *f
img = f.GetImageData()
delete im <- doh! this is a member of PixelConvert
delete h
delete f //thus we can not delete blindly PixelConvert
I have a patch in my local dir, I might commit it later tonite.
Basically what I do i uncomment :
//delete PixelConvert
but in PixelConvert I comment the RGB, and UncompressImage
I ran it on a few image with no leak. Ugly but it should work
Mathieu
More information about the Dcmlib
mailing list