top | item 37910607

(no title)

harerazer | 2 years ago

Then don't do that. Of all the footguns in POSIX/C programming, having to remember to free this is really not as bad as you seem to imply.

discuss

order

alexey-salmin|2 years ago

You miss the point. If you have full control over when and how getenv is called, there's no issue to begin with. The problem is that you don't, as OP demonstrates. It's perfectly natural to call getaddrinfo in a loop.

We need a new API which is not broken like in NetBSD, and a multi-year migration of all core libraries to it. Well a pity it wasn't started years ago though, could've been 95% done by now.

thayne|2 years ago

And how would you free it? The current posix API doesn't have any way to reliably free the result returned by `getenv`.