diff options
Diffstat (limited to 'elf/dl-open.c')
-rw-r--r-- | elf/dl-open.c | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/elf/dl-open.c b/elf/dl-open.c index 8d057f82eb..50c0d54f27 100644 --- a/elf/dl-open.c +++ b/elf/dl-open.c @@ -547,15 +547,9 @@ no more namespaces available for dlmopen()")); _dl_unload_cache (); #endif - /* Release the lock. */ - __rtld_lock_unlock_recursive (GL(dl_load_lock)); - + /* See if an error occurred during loading. */ if (__builtin_expect (errstring != NULL, 0)) { - /* Some error occurred during loading. */ - char *local_errstring; - size_t len_errstring; - /* Remove the object from memory. It may be in an inconsistent state if relocation failed, for example. */ if (args.map) @@ -572,12 +566,18 @@ no more namespaces available for dlmopen()")); GL(dl_tls_dtv_gaps) = true; #endif - _dl_close (args.map); + _dl_close_worker (args.map); } + assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT); + + /* Release the lock. */ + __rtld_lock_unlock_recursive (GL(dl_load_lock)); + /* Make a local copy of the error string so that we can release the memory allocated for it. */ - len_errstring = strlen (errstring) + 1; + size_t len_errstring = strlen (errstring) + 1; + char *local_errstring; if (objname == errstring + len_errstring) { size_t total_len = len_errstring + strlen (objname) + 1; @@ -594,14 +594,15 @@ no more namespaces available for dlmopen()")); if (malloced) free ((char *) errstring); - assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT); - /* Reraise the error. */ _dl_signal_error (errcode, objname, NULL, local_errstring); } assert (_dl_debug_initialize (0, args.nsid)->r_state == RT_CONSISTENT); + /* Release the lock. */ + __rtld_lock_unlock_recursive (GL(dl_load_lock)); + #ifndef SHARED DL_STATIC_INIT (args.map); #endif |