Basically #popt is broken if you want to avoid even one-off command line memory leaks.

https://www.revk.uk/2023/04/popt.html

popt

Linux has a really good library called popt. It parses command line arguments. I use it all the time, and it allows a variety of arguments t...

@revk amusingly, googling around this throws up a mailing list from *2010* where somebody reported this as a bug, and maintainer pretty much says "it's a feature, it's only a few bytes anyway quit yer whining".
@ahnlak I'd say not really a bug, just a fucking bad design decision.
@revk
So it'll either give you back a pointer you passed in, or a newly allocated pointer - but you know what pointers you pass in, so you can tell which are allocated by the library to ensure you free them?

When it comes to tidying up, the pedant in me wants to and it makes debugging easier, but it's wasted effort if you're not currently running in Valgrind. Could be worth only toggling on based on an environment variable?