Daniel Stenberg <[EMAIL PROTECTED]> writes:
> You're right of course. Hm. No, it can probably only happen if the first byte
> in an existing file is a zero-byte, so that strlen() return 0...
Yup. Or the first byte of any line. I.e. Wget will die if it
encounters the "\n\0" sequence of characte
On Tue, 20 Nov 2001, Hrvoje Niksic wrote:
> > Judging from the code, it probably happened when a file was
> > completely empty.
>
> Really? I thought that would be EOF, where fgets() should return 0.
You're right of course. Hm. No, it can probably only happen if the first byte
in an existing fi
Daniel Stenberg <[EMAIL PROTECTED]> writes:
> Judging from the code, it probably happened when a file was
> completely empty.
Really? I thought that would be EOF, where fgets() should return 0.
On Tue, 20 Nov 2001, Hrvoje Niksic wrote:
> As I said in the previous message, I now see a way for LENGTH to be zero,
> so I will remove the assert. Before I do that, I'd like to understand
> what problem Daniel was trying to fix, just in case I missed something.
I don't recall the exact situat
[EMAIL PROTECTED] writes:
> It's not just a memory leak. Length <= 0 is declared as a "can't
> happen". If length is zero, wget will suddenly end due to the
> assert. If a bad input file can lead to length being zero, then
> using assert is bad on principle. One should never assert external
> i
On 20/11/2001 10:12:05 Daniel Stenberg wrote:
>This subject says it all. The leak is minor, the fix could be made
>something like this:
>
>diff -u -r1.21 utils.c
>--- utils.c 2001/05/27 19:35:12 1.21
>+++ utils.c 2001/11/20 10:10:17
>@@ -903,7 +903,12 @@
> while (fgets (line + leng
Daniel Stenberg <[EMAIL PROTECTED]> writes:
> This subject says it all. The leak is minor, the fix could be made
> something like this:
What memory leak are you referring to in the subject?
Your patch replaces an assert() with a return NULL. The only way that
assert() could be tripped is by ha
This subject says it all. The leak is minor, the fix could be made something
like this:
diff -u -r1.21 utils.c
--- utils.c 2001/05/27 19:35:12 1.21
+++ utils.c 2001/11/20 10:10:17
@@ -903,7 +903,12 @@
while (fgets (line + length, bufsize - length, fp))
{
length += strle