summary refs log tree commit diff
path: root/elf/dl-open.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-06-12 16:29:51 +0000
committerUlrich Drepper <drepper@redhat.com>2005-06-12 16:29:51 +0000
commit74780cf659d1e5cd91e82b6e5314dcfc7bba033b (patch)
treed71a5f1c94a7b7ac1a117760f2f3bd45ab1eea1d /elf/dl-open.c
parent6dffebd8b4ef0e3310ac97cade0d5dc33c49dadc (diff)
downloadglibc-74780cf659d1e5cd91e82b6e5314dcfc7bba033b.tar.gz
glibc-74780cf659d1e5cd91e82b6e5314dcfc7bba033b.tar.xz
glibc-74780cf659d1e5cd91e82b6e5314dcfc7bba033b.zip
* elf/dl-error.c (_dl_signal_error): Store information about use of
	real malloc in the catch object.
	(_dl_catch_error): Forward information about malloc use to caller
	in new parameter.
	(_dl_out_of_memory): Make static.
	* elf/dl-deps.c: Adjust callers of _dl_catch_error.
	* elf/dl-libc.c: Likewise.
	* elf/dl-open.c: Likewise.
	* elf/rtld.c: Likewise.
	Add new --audit option.
	* sysdeps/generic/ldsodefs.h: Remove _dl_out_of_memory declaration.
	(rtld_global_ro._dl_signal_error): Add new parameter.
	* include/dlfcn.h (_dl_catch_error): Add new parameter.
	* dlfcn/dlfcn.c (_dlerror_run): Pass additional parameter to
	_dl_catch_error.  Only free if the returned newly value says so.
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r--elf/dl-open.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c
index a65690e5a3..984f4a4ec6 100644
--- a/elf/dl-open.c
+++ b/elf/dl-open.c
@@ -504,11 +504,6 @@ void *
 _dl_open (const char *file, int mode, const void *caller_dlopen, Lmid_t nsid,
 	  int argc, char *argv[], char *env[])
 {
-  struct dl_open_args args;
-  const char *objname;
-  const char *errstring;
-  int errcode;
-
   if ((mode & RTLD_BINDING_MASK) == 0)
     /* One of the flags must be set.  */
     _dl_signal_error (EINVAL, file, NULL, N_("invalid mode for dlopen()"));
@@ -543,6 +538,7 @@ no more namespaces available for dlmopen()"));
     _dl_signal_error (EINVAL, file, NULL,
 		      N_("invalid target namespace in dlmopen()"));
 
+  struct dl_open_args args;
   args.file = file;
   args.mode = mode;
   args.caller_dlopen = caller_dlopen;
@@ -552,7 +548,12 @@ no more namespaces available for dlmopen()"));
   args.argc = argc;
   args.argv = argv;
   args.env = env;
-  errcode = _dl_catch_error (&objname, &errstring, dl_open_worker, &args);
+
+  const char *objname;
+  const char *errstring;
+  bool malloced;
+  int errcode = _dl_catch_error (&objname, &errstring, &malloced,
+				 dl_open_worker, &args);
 
 #ifndef MAP_COPY
   /* We must munmap() the cache file.  */
@@ -603,7 +604,7 @@ no more namespaces available for dlmopen()"));
 	  memcpy (local_errstring, errstring, len_errstring);
 	}
 
-      if (errstring != _dl_out_of_memory)
+      if (malloced)
 	free ((char *) errstring);
 
       assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT);