diff options
Diffstat (limited to 'dlfcn/dlerror.c')
-rw-r--r-- | dlfcn/dlerror.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/dlfcn/dlerror.c b/dlfcn/dlerror.c index a754d3d9f6..eaf5ef9294 100644 --- a/dlfcn/dlerror.c +++ b/dlfcn/dlerror.c @@ -1,5 +1,6 @@ /* Return error detail for failing <dlfcn.h> functions. - Copyright (C) 1995, 96, 97, 98, 99, 2000 Free Software Foundation, Inc. + Copyright (C) 1995,1996,1997,1998,1999,2000,2002 + Free Software Foundation, Inc. This file is part of the GNU C Library. The GNU C Library is free software; you can redistribute it and/or @@ -148,6 +149,15 @@ init (void) static_buf = &last_result; } +static void +__attribute__ ((destructor)) +fini (void) +{ + if (last_result.errstring != NULL + && strcmp (last_result.errstring, "out of memory") != 0) + free ((char *) last_result.errstring); +} + /* Free the thread specific data, this is done if a thread terminates. */ static void |