Make sure everything that may be freed is allocated or initiated.

PR: 446
This commit is contained in:
Richard Levitte 2003-01-10 08:59:48 +00:00
parent 17244d193b
commit 85ca752e33

View File

@ -140,6 +140,7 @@ BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
BN_CTX *ctx; BN_CTX *ctx;
int checks = BN_prime_checks_for_size(bits); int checks = BN_prime_checks_for_size(bits);
BN_init(&t);
ctx=BN_CTX_new(); ctx=BN_CTX_new();
if (ctx == NULL) goto err; if (ctx == NULL) goto err;
if (ret == NULL) if (ret == NULL)
@ -148,7 +149,6 @@ BIGNUM *BN_generate_prime(BIGNUM *ret, int bits, int safe,
} }
else else
rnd=ret; rnd=ret;
BN_init(&t);
loop: loop:
/* make a random number and set the top and bottom bits */ /* make a random number and set the top and bottom bits */
if (add == NULL) if (add == NULL)