aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2013-01-23 14:24:34 +0000
committerChristopher Faylor <me@cgf.cx>2013-01-23 14:24:34 +0000
commita69e27906f250cfd96dfd431fd79b3749133128d (patch)
treeb8588a244552722e17c94e245dae050fd5e7a0b0
parent0e8c8b009361a87243874b8e576b9326d8ec9ab2 (diff)
downloadnewlib-a69e27906f250cfd96dfd431fd79b3749133128d.zip
newlib-a69e27906f250cfd96dfd431fd79b3749133128d.tar.gz
newlib-a69e27906f250cfd96dfd431fd79b3749133128d.tar.bz2
* miscfuncs.cc (__import_address): Check if malloc field points directly at
'malloc'.
-rw-r--r--winsup/cygwin/ChangeLog5
-rw-r--r--winsup/cygwin/malloc_wrapper.cc3
2 files changed, 7 insertions, 1 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog
index ef1fbab..873b943 100644
--- a/winsup/cygwin/ChangeLog
+++ b/winsup/cygwin/ChangeLog
@@ -1,5 +1,10 @@
2013-01-23 Christopher Faylor <me.cygwin2013@cgf.cx>
+ * miscfuncs.cc (__import_address): Check if malloc field points
+ directly at 'malloc'.
+
+2013-01-23 Christopher Faylor <me.cygwin2013@cgf.cx>
+
* miscfuncs.cc (__import_address): On second thought, the chance that
this pointer could be NULL is very low so don't bother checking for it.
diff --git a/winsup/cygwin/malloc_wrapper.cc b/winsup/cygwin/malloc_wrapper.cc
index c514af3..2adacba 100644
--- a/winsup/cygwin/malloc_wrapper.cc
+++ b/winsup/cygwin/malloc_wrapper.cc
@@ -286,7 +286,8 @@ malloc_init ()
extern void *_sigfe_malloc;
/* Decide if we are using our own version of malloc by testing the import
address from user_data. */
- use_internal = import_address (user_data->malloc) == &_sigfe_malloc;
+ use_internal = user_data->malloc == malloc
+ || import_address (user_data->malloc) == &_sigfe_malloc;
malloc_printf ("using %s malloc", use_internal ? "internal" : "external");
internal_malloc_determined = true;
}