[Dcmlib] Re: ptotential memory leak without virtual destructor.

Mathieu Malaterre mathieu.malaterre at kitware.com
Mon Nov 15 17:16:50 CET 2004


Awsome! We'll see tomorrow the output of valgrind:

http://public.kitware.com/Public/Sites/zorglub/GDCM-Linux-g++/20041115-0100-Nightly/DynamicAnalysis.html

Thanks
Mathieu

Benoit Regrain wrote:
> Hi Mathieu,
> 
> I've made some changes in files to correct this bug and the concerned
> examples.
> It's in my lasts commits.
> 
> Benoit
> 
> ----- Original Message ----- 
> From: "Mathieu Malaterre" <mathieu.malaterre at kitware.com>
> To: <jean-michel.rouet at philips.com>
> Cc: <dcmlib at creatis.insa-lyon.fr>
> Sent: Monday, November 15, 2004 4:31 PM
> Subject: Re: [Dcmlib] Re: ptotential memory leak without virtual destructor.
> 
> 
> 
>>>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
>>
>>
>>_______________________________________________
>>Dcmlib mailing list
>>Dcmlib at creatis.insa-lyon.fr
>>http://www.creatis.insa-lyon.fr/mailman/listinfo/dcmlib
> 
> 
> 






More information about the Dcmlib mailing list