summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMike Hommey <mh@glandium.org>2016-07-08 04:28:16 (GMT)
committerMike Hommey <mh@glandium.org>2016-07-08 04:28:16 (GMT)
commit4abaee5d13a54c677cd132c481dbf7621f785fec (patch)
treeeeb5194717cdda94f7109c23589fa591f313b43f /src
parent47b34dd39850b8b157c67887d9b6bf7bd3095796 (diff)
downloadjemalloc-4abaee5d13a54c677cd132c481dbf7621f785fec.zip
jemalloc-4abaee5d13a54c677cd132c481dbf7621f785fec.tar.gz
jemalloc-4abaee5d13a54c677cd132c481dbf7621f785fec.tar.bz2
Avoid getting the same default zone twice in a row.
847ff22 added a call to malloc_default_zone() before the main loop in register_zone, effectively making malloc_default_zone() called twice without any different outcome expected in the returned result. It is also called once at the beginning, and a second time at the end of the loop block. Instead, call it only once per iteration.
Diffstat (limited to 'src')
-rw-r--r--src/zone.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/zone.c b/src/zone.c
index ca235da..9432f45 100644
--- a/src/zone.c
+++ b/src/zone.c
@@ -246,7 +246,6 @@ register_zone(void)
malloc_zone_register(&zone);
do {
- default_zone = malloc_default_zone();
/*
* Unregister and reregister the default zone. On OSX >= 10.6,
* unregistering takes the last registered zone and places it
@@ -272,5 +271,7 @@ register_zone(void)
malloc_zone_unregister(purgeable_zone);
malloc_zone_register(purgeable_zone);
}
- } while (malloc_default_zone() != &zone);
+
+ default_zone = malloc_default_zone();
+ } while (default_zone != &zone);
}