aboutsummaryrefslogtreecommitdiff
path: root/dlfcn
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 /dlfcn
parent6dffebd8b4ef0e3310ac97cade0d5dc33c49dadc (diff)
downloadglibc-74780cf659d1e5cd91e82b6e5314dcfc7bba033b.tar
glibc-74780cf659d1e5cd91e82b6e5314dcfc7bba033b.tar.gz
glibc-74780cf659d1e5cd91e82b6e5314dcfc7bba033b.tar.bz2
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 'dlfcn')
-rw-r--r--dlfcn/dlerror.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c
index 1254381f2b..7ea31d4392 100644
--- a/dlfcn/dlerror.c
+++ b/dlfcn/dlerror.c
@@ -19,6 +19,7 @@
#include <dlfcn.h>
#include <libintl.h>
+#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -40,6 +41,7 @@ struct dl_action_result
{
int errcode;
int returned;
+ bool malloced;
const char *objname;
const char *errstring;
};
@@ -154,13 +156,13 @@ _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. */
- if (strcmp (result->errstring, "out of memory") != 0)
+ if (result->malloced)
free ((char *) result->errstring);
result->errstring = NULL;
}
result->errcode = GLRO(dl_catch_error) (&result->objname, &result->errstring,
- operate, args);
+ &result->malloced, operate, args);
/* If no error we mark that no error string is available. */
result->returned = result->errstring == NULL;