[fpc-pascal] [ISSUE] FCL-Web: TUploadedFile causing memory leak?
silvioprog
silvioprog at gmail.com
Mon Jul 15 18:52:57 CEST 2013
2013/7/15 Michael Van Canneyt <michael at freepascal.org>
> On Sun, 14 Jul 2013, silvioprog wrote:
>
>> Hello,
>> Please see:
>>
>> http://bugs.freepascal.org/**view.php?id=24746<http://bugs.freepascal.org/view.php?id=24746>
>>
>
> There are several things VERY wrong with your test program.
> First:
> VFile.Read(VBuf, VBufLen); // reading only the first 1024 bytes ...
> Overrides the VBUf address.
>
> It must be
> VFile.Read(VBuf[0], VBufLen); // reading only the first 1024 bytes ...
>
>
> Secondly,
> VFile.Free; // free stream allowing to delete uploaded file, but, it
> causes
> Frees the stream, but does not set the Stream property of TUploadedFile
> to nil.
> When TUploadedFile is freed, it frees again the memory stream, causing an
> access violation.
>
> I do not understand how your program could ever function.
> I got access violations all over the place trying to run it.
>
> Anyway, after fixing the 2 above issues it ran smootly.
> Now, I suspect that the DeleteTempUploadedFiles does not work because
> Windows has the files locked when you attempt to delete them, so I changed
> TUploadedFile.**DeleteTempUploadedFile
> so it first frees the stream if there is one.
>
> (cannot test that under Linux, where the demo runs fine)
>
> Michael.
Yes! :)
I'll test it and reply via mantis. Wait me please ...
--
Silvio Clécio
My public projects - github.com/silvioprog
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20130715/9e91e574/attachment.html>
More information about the fpc-pascal
mailing list