summary refs log tree commit diff
path: root/elf/dl-error.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2000-07-13 19:46:27 +0000
committerUlrich Drepper <drepper@redhat.com>2000-07-13 19:46:27 +0000
commitca3c01356495ebfbb315c2984dda8eba88467597 (patch)
tree1a39c90278b0888a0f10ab83526912c977bcbc81 /elf/dl-error.c
parentaa4068f2945ff0b263d9fc6342c39767bf723327 (diff)
downloadglibc-ca3c01356495ebfbb315c2984dda8eba88467597.tar.gz
glibc-ca3c01356495ebfbb315c2984dda8eba88467597.tar.xz
glibc-ca3c01356495ebfbb315c2984dda8eba88467597.zip
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 'elf/dl-error.c')
-rw-r--r--elf/dl-error.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/elf/dl-error.c b/elf/dl-error.c
index 88ab8e9519..959e1de202 100644
--- a/elf/dl-error.c
+++ b/elf/dl-error.c
@@ -45,6 +45,12 @@ __libc_tsd_define (static, DL_ERROR)
 #define tsd_setspecific(data)	__libc_tsd_set (DL_ERROR, (data))
 
 
+/* This message we return as a last resort.  We define the string in a
+   variable since we have to avoid freeing it and so have to enable
+   a pointer comparison.  See below and in dlfcn/dlerror.c.  */
+const char _dl_out_of_memory[] = "out of memory";
+
+
 /* This points to a function which is called when an continuable error is
    received.  Unlike the handling of `catch' this function may return.
    The arguments will be the `errstring' and `objname'.
@@ -72,6 +78,8 @@ _dl_signal_error (int errcode, const char *objname, const char *errstring)
 	 stack.  The object name is always a string constant.  */
       lcatch->objname = objname;
       lcatch->errstring = strdup (errstring);
+      if (lcatch->errstring == NULL)
+	lcatch->errstring = _dl_out_of_memory;
       longjmp (lcatch->env, errcode ?: -1);
     }
   else