> fanlb <[EMAIL PROTECTED]> writes:
>> Would u1 been leaved in memory,if allocation for u1 were succeeded
>> but u2 failed?
> If any memory allocation fails, Wget exits with an appropriate error
> message.
I think there's a valid point here. The memory allocation part of the
question was misleading though. There is a memory leak in url_equal() if the
second parseurl() returns a value other than URLOK. u1 is never freed in that
scenario. Here's a simplistic patch:
Index: url.c
===================================================================
RCS file: /pack/anoncvs/wget/src/url.c,v
retrieving revision 1.44
diff -u -r1.44 url.c
--- url.c 2001/04/26 10:11:49 1.44
+++ url.c 2001/05/18 20:06:52
@@ -792,6 +792,7 @@
err = parseurl (url2, u2, 0);
if (err != URLOK)
{
+ freeurl (u1, 1);
freeurl (u2, 1);
return 0;
}
But I guess this is a completely pedantic issue. I don't see any code in wget
that even uses url_equal(), or am I missing something?
While we're being pedantic though, it seems to me that the return values for
url_equal() were poorly chosen with both the "not equal" condition and the
error condition defined to be the same return value. But it doesn't matter
really, so there's little point in changing it.