Call the right helper function when setting mallopt M_ARENA_MAX

Message ID 20170330184112.GA19395@amethyst.visucore.com
State New, archived
Headers

Commit Message

Wladimir J. van der Laan March 30, 2017, 6:41 p.m. UTC
  Fixes a typo introduced in commit
be7991c0705e35b4d70a419d117addcd6c627319. This caused
mallopt(M_ARENA_MAX) as well as the environment variable
MALLOC_ARENA_MAX to not work as intended because it set the
wrong internal parameter.

	* malloc/malloc.c: Call do_set_arena_max for M_ARENA_MAX
	instead of incorrect do_set_arena_test
---
 ChangeLog       | 5 +++++
 malloc/malloc.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
  

Comments

Florian Weimer March 30, 2017, 8:12 p.m. UTC | #1
* Wladimir J. van der Laan:

> Fixes a typo introduced in commit
> be7991c0705e35b4d70a419d117addcd6c627319. This caused
> mallopt(M_ARENA_MAX) as well as the environment variable
> MALLOC_ARENA_MAX to not work as intended because it set the
> wrong internal parameter.
>
> 	* malloc/malloc.c: Call do_set_arena_max for M_ARENA_MAX
> 	instead of incorrect do_set_arena_test

Patch looks good, but I think this warrants a bug report and reference
to it in the ChangeLog.
  

Patch

diff --git a/ChangeLog b/ChangeLog
index eaf7bb1..536e35f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@ 
+2017-03-30  Wladimir van der Laan  <laanwj@gmail.com>
+
+	* malloc/malloc.c: Call do_set_arena_max for M_ARENA_MAX
+	instead of incorrect do_set_arena_test
+
 2017-03-30  Gabriel F. T. Gomes  <gftg@linux.vnet.ibm.com>
 
 	* math/math.h: Include bits/math-finite.h once per
diff --git a/malloc/malloc.c b/malloc/malloc.c
index 994a232..4c40e2e 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4904,7 +4904,7 @@  __libc_mallopt (int param_number, int value)
 
     case M_ARENA_MAX:
       if (value > 0)
-	do_set_arena_test (value);
+	do_set_arena_max (value);
       break;
     }
   __libc_lock_unlock (av->mutex);