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...

And my next #C question 🙂

I use #popt a lot, it is great.

I always find some memory issue left over when running #valgrind, caused by popt. It is always small and so not something I worried much about.

I noticed it seems to be that a string argument to my command from popt is in fact malloc'd. I.e. I can free() it without error, and that fixes the valgrind complaint.

But the man page on popt does not say which things it malloc's.

Does popt always do it?