summaryrefslogtreecommitdiff
path: root/tests/tgrandom.c
diff options
context:
space:
mode:
authorvlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-29 13:45:57 +0000
committervlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4>2016-01-29 13:45:57 +0000
commite6559be7a708e66ac9ec633cd9cc0e4d07b2105b (patch)
treeb3bc396e5e1c3a9672c788c8f9742347c565157f /tests/tgrandom.c
parente32c09fe27c46519c27672c841764b72c9615b20 (diff)
downloadmpfr-e6559be7a708e66ac9ec633cd9cc0e4d07b2105b.tar.gz
Cleanup of memory allocation in the tests:
* only tests_allocate, tests_reallocate and tests_free should be used (now exported instead of mpfr_default_allocate, etc.); * this is now mentioned in doc/README.dev; * added checks to tools/mpfrlint (heuristics as usual). Note: This follows the discussion at https://sympa.inria.fr/sympa/arc/mpfr/2015-12/msg00055.html and should solve these problems under MS Windows (mingw32), though this cleanup is more general than an attempt to fix a Windows issue. git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@9891 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'tests/tgrandom.c')
-rw-r--r--tests/tgrandom.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/tests/tgrandom.c b/tests/tgrandom.c
index c8f452cb0..75dccc0c9 100644
--- a/tests/tgrandom.c
+++ b/tests/tgrandom.c
@@ -56,12 +56,7 @@ test_grandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd,
int i, inexact;
nbtests = (nbtests & 1) ? (nbtests + 1) : nbtests;
- t = (mpfr_t *) malloc (nbtests * sizeof (mpfr_t));
- if (t == NULL)
- {
- fprintf (stderr, "tgrandom: can't allocate memory in test_grandom\n");
- exit (1);
- }
+ t = (mpfr_t *) tests_allocate (nbtests * sizeof (mpfr_t));
for (i = 0; i < nbtests; ++i)
mpfr_init2 (t[i], prec);
@@ -106,7 +101,7 @@ test_grandom (long nbtests, mpfr_prec_t prec, mpfr_rnd_t rnd,
for (i = 0; i < nbtests; ++i)
mpfr_clear (t[i]);
- free (t);
+ tests_free (t, nbtests * sizeof (mpfr_t));
return;
}