Hi, On Mon, Nov 09, 2015 at 07:11:16AM +0100, Arne Schwabe wrote: > > I can see why we do this gc_addspecial() dance in socket.c (because the > > elements returned by getaddrinfo() are being pointed at, not copied). > > > > This usage here seems unneeded, as the code will walk netlist, copy > > out the IPv4 addresses into a separate (gc-allocated) struct route_ipv4, > > and never use parts of netlist again - so freeaddrinfo() *should* work, > > and make the code slightly less complex. > > > > Arne, this came from you in commit e719a053534 (and I ACKed it) - could > > you revisit this particular use and check whether it's truly needed? > > I don't think it is really needed. It is more consistency and we try to > use gc functions instead of free/malloc.
Uh, I'm not sure I buy the "consistency" argument here - today we call freeaddrinfo() in 9 places (not counting buffer.h), and gc_addspecial() in 2 places... so I'd more call for "simplicity wins", that is, if there is no reason to delay calling freeaddrinfo(), we shouldn't do so - the memory in use is not related to a gc... Do you agree? (For the time being I have merged Steffan's patch to fix the memory leak, because it's a well-defined and correct change on its own - but I think this one still needs changing :-)) gert -- USENET is *not* the non-clickable part of WWW! //www.muc.de/~gert/ Gert Doering - Munich, Germany g...@greenie.muc.de fax: +49-89-35655025 g...@net.informatik.tu-muenchen.de
signature.asc
Description: PGP signature