Avoid segfault if ret==0.
authorUlf Möller <ulf@openssl.org>
Sat, 6 Dec 2003 11:39:37 +0000 (11:39 +0000)
committerUlf Möller <ulf@openssl.org>
Sat, 6 Dec 2003 11:39:37 +0000 (11:39 +0000)
Submitted by: Nils Larsch

crypto/bn/bn_gcd.c

index f02e6fcdb422903cff18eaeba6b7ee9313dfe09f..0248753f6dc9a0f1499fb19d092d0c7d5b37b640 100644 (file)
@@ -488,6 +488,7 @@ BIGNUM *BN_mod_inverse(BIGNUM *in,
 err:
        if ((ret == NULL) && (in == NULL)) BN_free(R);
        BN_CTX_end(ctx);
-       bn_check_top(ret);
+       if (ret)
+               bn_check_top(ret);
        return(ret);
        }