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 f02e6fc..0248753 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);
        }