diff options
author | Ulrich Drepper <drepper@redhat.com> | 2000-07-13 19:46:27 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2000-07-13 19:46:27 +0000 |
commit | ca3c01356495ebfbb315c2984dda8eba88467597 (patch) | |
tree | 1a39c90278b0888a0f10ab83526912c977bcbc81 /dlfcn | |
parent | aa4068f2945ff0b263d9fc6342c39767bf723327 (diff) | |
download | glibc-ca3c01356495ebfbb315c2984dda8eba88467597.tar.gz |
Update.
* elf/Versions (ld): Export _dl_out_of_memory for GLIBC_2.2.
* dlfcn/dlerror.c (dlerror): Don't free the error string if it is the
report that we are out of memory.
* elf/dl-deps.c (_dl_map_object_deps): Likewise.
* elf/dl-libc.c (dlerror_run): Likewise.
* elf/dl-open.c (_dl_open): Likewise.
* elf/rtld.c (dl_main): Likewise.
* elf/dl-error.c: Define _dl_out_of_memory.
(_dl_signal_error): Return _dl_signal_error if we cannot duplicate
the error string.
* sysdeps/generic/ldsodefs.h: Declare _dl_out_of_memory.
* dlfcn/dlerror.c (free_key_mem): Also free error string.
* iconv/loop.c: Fix comment.
Diffstat (limited to 'dlfcn')
-rw-r--r-- | dlfcn/dlerror.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c index 34ea82907e..1650eca729 100644 --- a/dlfcn/dlerror.c +++ b/dlfcn/dlerror.c @@ -35,7 +35,6 @@ struct dl_action_result static struct dl_action_result last_result; static struct dl_action_result *static_buf; - /* This is the key for the thread specific memory. */ static __libc_key_t key; @@ -61,7 +60,8 @@ dlerror (void) /* We can now free the string. */ if (result->errstring != NULL) { - free ((char *) result->errstring); + if (strcmp (result->errstring, "out of memory") != 0) + free ((char *) result->errstring); result->errstring = NULL; } buf = NULL; @@ -75,7 +75,8 @@ dlerror (void) strerror (result->errcode)) != -1) { /* We don't need the error string anymore. */ - free ((char *) result->errstring); + if (strcmp (result->errstring, "out of memory") != 0) + free ((char *) result->errstring); result->errstring = buf; } @@ -123,7 +124,8 @@ _dlerror_run (void (*operate) (void *), void *args) { /* Free the error string from the last failed command. This can happen if `dlerror' was not run after an error was found. */ - free ((char *) result->errstring); + if (strcmp (result->errstring, "out of memory") != 0) + free ((char *) result->errstring); result->errstring = NULL; } @@ -153,6 +155,12 @@ init (void) static void free_key_mem (void *mem) { + struct dl_action_result *result = (struct dl_action_result *) mem; + + if (result->errstring != NULL + && strcmp (result->errstring, "out of memory") != 0) + free (result->errstring); + free (mem); __libc_setspecific (key, NULL); } |