From 74780cf659d1e5cd91e82b6e5314dcfc7bba033b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 12 Jun 2005 16:29:51 +0000 Subject: * 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. --- elf/dl-open.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'elf/dl-open.c') diff --git a/elf/dl-open.c b/elf/dl-open.c index a65690e..984f4a4 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); -- cgit v1.1