]> sourceware.org Git - glibc.git/commitdiff
elf: Call free from base namespace on error in dl-libc.c [BZ #27646]
authorFlorian Weimer <fweimer@redhat.com>
Tue, 6 Jul 2021 11:22:01 +0000 (13:22 +0200)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 6 Jul 2021 12:30:33 +0000 (14:30 +0200)
In dlerror_run, free corresponds to the local malloc in the
namespace, but GLRO (dl_catch_error) uses the malloc from the base
namespace.  elf/tst-dlmopen-gethostbyname triggers this mismatch,
but it does not crash, presumably because of a fastbin deallocation.

Fixes commit c2059edce20c124d1a99f1a94cc52e83b77a917a ("elf: Use
_dl_catch_error from base namespace in dl-libc.c [BZ #27646]") and
commit b2964eb1d9a6b8ab1250e8a881cf406182da5875 ("dlfcn: Failures
after dlmopen should not terminate process [BZ #24772]").

elf/dl-libc.c

index a49df220294e897bdab2dcdb817d4b6ae3de2a09..ba792e9589b48a47f9a6bef399664ba168c46a85 100644 (file)
@@ -48,7 +48,7 @@ dlerror_run (void (*operate) (void *), void *args)
                ?: last_errstring != NULL);
 
   if (result && malloced)
-    free ((char *) last_errstring);
+    GLRO (dl_error_free) ((char *) last_errstring);
 
   return result;
 }
This page took 0.04133 seconds and 5 git commands to generate.