4 ms·
I think you would have to change the API to return a copy of the string as the get_env result which the caller is responsible for free-ing or the env implementa
by benmmurphy 2y ago
I think you would have to change the API to return a copy of the string as the get_env result which the caller is responsible for free-ing or the env implementation would have to ensure returned values from get_env are stable and never change which is effectively a memory leak.
- layer8 2y agoGetenv_r() does this: https://man.netbsd.org/getenv_r.3 https://man.netbsd.org/getenv_r.3