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. --- dlfcn/dlerror.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'dlfcn') diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c index 1254381..7ea31d4 100644 --- a/dlfcn/dlerror.c +++ b/dlfcn/dlerror.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -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; -- cgit v1.1