Giuseppe Modugno
2018-04-05 14:44:30 UTC
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.
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.