summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLinus Nordberg <linus@nordberg.se>2000-04-04 11:06:22 +0200
committerLinus Nordberg <linus@nordberg.se>2000-04-04 11:06:22 +0200
commitee77e57299b363d5b606f8ce20c0fa8758ce2be1 (patch)
treeb90b3173b8936a9f319d3bd5461d54c9169dc1df
parentd5ba794638209e43103f41f150133a2678840440 (diff)
downloadgmp-ee77e57299b363d5b606f8ce20c0fa8758ce2be1.tar.gz
Allocate enough space for seed to hold any upcoming seed.
-rw-r--r--randlc.c1
-rw-r--r--randlc2x.c2
2 files changed, 3 insertions, 0 deletions
diff --git a/randlc.c b/randlc.c
index b46ca61ed..f97706a7a 100644
--- a/randlc.c
+++ b/randlc.c
@@ -39,6 +39,7 @@ gmp_rand_init_lc (s, a, c, m)
#endif
{
mpz_init_set_ui (s->seed, 1);
+ _mpz_realloc (s->seed, ABSIZ (m));
/* Allocate algorithm specific data. */
s->data.lc = (__gmp_rand_data_lc *)
diff --git a/randlc2x.c b/randlc2x.c
index 3999d406b..48273fc41 100644
--- a/randlc2x.c
+++ b/randlc2x.c
@@ -39,6 +39,8 @@ gmp_rand_init_lc_2exp (s, a, c, m2exp)
#endif
{
mpz_init_set_ui (s->seed, 1);
+ _mpz_realloc (s->seed, m2exp / BITS_PER_MP_LIMB
+ + (m2exp % BITS_PER_MP_LIMB != 0));
/* Allocate algorithm specific data. */
s->data.lc = (__gmp_rand_data_lc *)