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

Benoit Regrain benoit.regrain at creatis.insa-lyon.fr
Mon Nov 15 17:16:23 CET 2004


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