diff options
author | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-06-19 15:38:44 +0000 |
---|---|---|
committer | hanrot <hanrot@280ebfd0-de03-0410-8827-d642c229c3f4> | 2000-06-19 15:38:44 +0000 |
commit | ade63f027c22e0a8cb6a15e65d45f52d5fe4e131 (patch) | |
tree | 91d37b79c6d24cb67602f0c1353a37f374f93b9c | |
parent | c2af0b84d1be8500c4546b177fbea407a7fd7c68 (diff) | |
download | mpfr-ade63f027c22e0a8cb6a15e65d45f52d5fe4e131.tar.gz |
Suppressed memory leaks.
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@636 280ebfd0-de03-0410-8827-d642c229c3f4
-rw-r--r-- | tests/tcmp_ui.c | 28 | ||||
-rw-r--r-- | tests/tsqrt.c | 4 |
2 files changed, 25 insertions, 7 deletions
diff --git a/tests/tcmp_ui.c b/tests/tcmp_ui.c index 3242b7cbf..0038576c5 100644 --- a/tests/tcmp_ui.c +++ b/tests/tcmp_ui.c @@ -33,25 +33,39 @@ int main() mpfr_init(x); mpfr_set_ui(x, 3, GMP_RNDZ); - if (mpfr_cmp_ui(x, i=3)!=0) { - printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); exit(1); + if (mpfr_cmp_ui(x, i=3)!=0) { + printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); + mpfr_clear(x); + exit(1); } if (mpfr_cmp_ui(x, i=2)<=0) { - printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); exit(1); + printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); + mpfr_clear(x); + exit(1); } if (mpfr_cmp_ui(x, i=4)>=0) { - printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); exit(1); + printf("Error in mpfr_cmp_ui(%1.20f,%lu)\n",mpfr_get_d(x), i); + mpfr_clear(x); + exit(1); } mpfr_set_si(x, -3, GMP_RNDZ); if (mpfr_cmp_si(x, s=-3)!=0) { - printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d(x), s); exit(1); + printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d(x), s); + mpfr_clear(x); + exit(1); } if (mpfr_cmp_si(x, s=-4)<=0) { - printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d(x), s); exit(1); + printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d(x), s); + mpfr_clear(x); + exit(1); } if (mpfr_cmp_si(x, s=1)>=0) { - printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d(x), s); exit(1); + printf("Error in mpfr_cmp_si(%1.20f,%ld)\n",mpfr_get_d(x), s); + mpfr_clear(x); + exit(1); } + + mpfr_clear(x); return 0; } diff --git a/tests/tsqrt.c b/tests/tsqrt.c index ee1e234e2..d6aef7062 100644 --- a/tests/tsqrt.c +++ b/tests/tsqrt.c @@ -51,6 +51,7 @@ void check3(a, rnd_mode, Q) double a; unsigned char rnd_mode; double Q; else { if (Q != sqrt(a)) { fprintf(stderr, "you've found a bug in your machine's sqrt for x=%1.20e\n", a); + mpfr_clear(q); exit(1); } @@ -62,6 +63,7 @@ void check3(a, rnd_mode, Q) double a; unsigned char rnd_mode; double Q; printf("mpfr_sqrt failed for a=%1.20e, rnd_mode=%s\n", a, mpfr_print_rnd_mode(rnd_mode)); printf("expected sqrt is %1.20e, got %1.20e (%d ulp)\n",Q,Q2,u); + mpfr_clear(q); exit(1); } else if (u>maxulp || u<-maxulp) { @@ -87,8 +89,10 @@ void check4(a, rnd_mode, Q) double a; unsigned char rnd_mode; char *Q; a, mpfr_print_rnd_mode(rnd_mode)); printf("expected "); mpfr_print_raw(res); putchar('\n'); printf("got "); mpfr_print_raw(q); putchar('\n'); + mpfr_clear(q); mpfr_clear(res); exit(1); } + mpfr_clear(res); mpfr_clear(q); } |