After I call getpwuid(uid)
, I have a reference to a pointer. Should I free that pointer when I don't use it anymore? Reading the man pages, it says that it makes reference to some static area, that may be overwritten by subsequent calls to the same functions, so I'm not sure if I should touch that memory area.
Thanks.
No. You do not need to free the result. You can only call free(3) on pointers allocated on the heap with malloc(3), calloc(3) or realloc(3).
Static data is part of a program's data or bss segments and will persist until the process exits (or is overwritten by exec(2)).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With