Should unsetenv() free?

Giuseppe Modugno giuseppe.modugno.loqed@gmail.com
Thu Apr 5 14:44:00 GMT 2018


I'm sorry for the stupid question, but I'm newbie with newlib.

I'm using environment functionalities of newlib and I noticed setenv() 
calls malloc/realloc to increase the array of pointers (that point to 
the "<variable>=<value>" strings) and calls malloc to allocate the 
"<variable>=<value>" string of the just added variable.

So why doesn't unsetenv call free? It seems to me that it only deletes 
the pointer in the environment array, but it doesn't free the string.




More information about the Newlib mailing list