Make sure everything that may be freed is allocated or initiated.
authorRichard Levitte <levitte@openssl.org>
Fri, 10 Jan 2003 08:59:48 +0000 (08:59 +0000)
committerRichard Levitte <levitte@openssl.org>
Fri, 10 Jan 2003 08:59:48 +0000 (08:59 +0000)
PR: 446

crypto/bn/bn_prime.c

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