diff --git a/c/armsys b/c/armsys index 66f69aacbf562401ce6af463ab17f74168f1285e..61ca6a2de95c64acc17eee7e982b7cae0983afd1 100644 --- a/c/armsys +++ b/c/armsys @@ -370,6 +370,14 @@ char *getenv(const char *name) return _getenv_value; } +void _terminate_getenv(void) +{ + if (_getenv_value) + free(_getenv_value); + + _getenv_value = NULL; +} + #ifdef DDE #define DDEUtils_SetCLSize 0x42581 #define DDEUtils_SetCL 0x42582 diff --git a/c/stdlib b/c/stdlib index 1fa50633b3a345470c150d90eb76261f1d57d4d2..f845ca5367455d50c406a8b869cfeec3baea4b80 100644 --- a/c/stdlib +++ b/c/stdlib @@ -103,7 +103,7 @@ static union { vprocp p; int i; } _exitvector[EXIT_LIMIT] = {}; /* initialised so not in bss (or shared library trouble) */ static struct { char number_of_exit_functions; - char alloc_finalised, io_finalised; + char alloc_finalised, io_finalised, getenv_finalised; } exit_s; void _exit_init() @@ -117,7 +117,7 @@ void _exit_init() } } else exit_s.number_of_exit_functions = 0; - exit_s.alloc_finalised = 0; exit_s.io_finalised = 0; + exit_s.alloc_finalised = 0; exit_s.io_finalised = 0; exit_s.getenv_finalised = 0; } int atexit(vprocp func) @@ -137,6 +137,7 @@ void _lib_shutdown() _call_client_0(fn); } /* ensure no recursion if finalisation fails */ + if (!exit_s.getenv_finalised) { exit_s.getenv_finalised = 1; _terminate_getenv(); } if (!exit_s.alloc_finalised) { exit_s.alloc_finalised = 1; _terminate_user_alloc(); } if (!exit_s.io_finalised) { exit_s.io_finalised = 1; _terminateio(); } } diff --git a/s/version b/s/version index 62fce0874a18053895c6982276981b7227341e8f..bcd26e515d79b0085c066b634fd6547eda9bceaa 100644 --- a/s/version +++ b/s/version @@ -12,5 +12,5 @@ ; See the License for the specific language governing permissions and ; limitations under the License. ; - DCB "4.85 (19 Dec 1996)" + DCB "4.86 (27 Jul 1998)" END