I only took a quick glance, but I think there may be some issues
with freeaddrinfo() use. For example, in sbr/client.c client() a
NULL pointer can be passed to freeaddrinfo(). That doesn't work
on a lot of platforms. Second, it seems memory is being leaked
in that function if you get a result set from getaddrinfo(), but
fail to connect and then call getaddrinfo() again with a
different host.
Well, there were already plenty of memory leaks in there before! But
seriously, that doesn't mean that we should create more.
I took a closer look at client.c again. I think I see what you mean;
I put freeaddrinfo() at the wrong spot (I think it should be inside
of the loop over the servers). I believe that addresses both the issue
of memory leakage and calls to freeaddrinfo() with a NULL argument.
I think I tried to be careful to do that in most places (client.c was
the most complicated code I had to deal with).
Additionally, I don't know if you can assume that res will be set
to NULL if getaddrinfo() fails. Since the spec doesn't specify,
I figure it could be in any state on error: NULL, never changed,
or pointing at a result set.
Right. My tactic was to only call freeaddrinfo() if getaddrinfo() was
successful.
--Ken
_______________________________________________
Nmh-workers mailing list
Nmh-workers(_at_)nongnu(_dot_)org
http://lists.nongnu.org/mailman/listinfo/nmh-workers