Re: [Podofo-users] Memory leaks in PdfImage::LoadFromTiffHandle

2019-11-13 Thread zyx
On Wed, 2019-11-13 at 19:47 +0100, Michal Sudolsky wrote: > I do not see any reason why would be better to use preprocessor to > switch between "[0]" and "data.data()" Hi, there might be a reason why the vector::data() had been added. Maybe it's a cleaner way to access the data. Also, as

Re: [Podofo-users] Memory leaks in PdfImage::LoadFromTiffHandle

2019-11-13 Thread Michal Sudolsky
> > Until this patch the code was buildable with ancient compilers, which > do not support vector::data(). I am sending modified patch. I do not see any reason why would be better to use preprocessor to switch between "[0]" and "data.data()". The first form should do same thing on C++11 as on

Re: [Podofo-users] Memory leaks in PdfImage::LoadFromTiffHandle

2019-11-13 Thread zyx
On Wed, 2019-11-13 at 13:12 +, Pietro Paolini wrote: > I am not aware of such construct being available in C++ - and a > quick grep on the source code does not match any custom stuff built > in to provide an equivalent functionality. Hi, I'm not sure which of the two you mean. If

Re: [Podofo-users] Memory leaks in PdfImage::LoadFromTiffHandle

2019-11-13 Thread Pietro Paolini
I am not aware of such construct being available in C++ - and a quick grep on the source code does not match any custom stuff built in to provide an equivalent functionality. Is it hidden somewhere ? On 13/11/2019 08:53, zyx wrote: On Tue, 2019-11-12 at 20:52 +0100, Michal Sudolsky wrote:

Re: [Podofo-users] Memory leaks in PdfImage::LoadFromTiffHandle

2019-11-13 Thread zyx
On Tue, 2019-11-12 at 20:52 +0100, Michal Sudolsky wrote: > Patch attached. Hi, the "try {} __finally {}" would make the job as well, right? > +PdfMemoryInputStream stream( data.data(), data.size() ); Until this patch the code was buildable with ancient compilers, which do

[Podofo-users] Memory leaks in PdfImage::LoadFromTiffHandle

2019-11-12 Thread Michal Sudolsky
If is podofo exception thrown between "new" and "delete" then this memory will be leaked. Lines 638-663: ``` char *buffer = new char[bufferSize]; if( !buffer ) { TIFFClose(hInTiffHandle); PODOFO_RAISE_ERROR( ePdfError_OutOfMemory ); } for(row = 0; row < height;