X-Git-Url: https://git.openssl.org/?a=blobdiff_plain;f=crypto%2Fasn1%2Ft_req.c;h=ea1af092db3fb09c44c44bf6d4e7f54de0a3aa92;hb=65b002f39934a755b6db855c9f9ba722d6cef863;hp=81dd6355a887368e496fb4b4b2a2e562dcebe801;hpb=bc23b70e47531cabe5b3c329ba0b5d58777fbb7b;p=openssl.git diff --git a/crypto/asn1/t_req.c b/crypto/asn1/t_req.c index 81dd6355a8..ea1af092db 100644 --- a/crypto/asn1/t_req.c +++ b/crypto/asn1/t_req.c @@ -119,7 +119,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) pkey=X509_REQ_get_pubkey(x); #ifndef NO_RSA - if (pkey->type == EVP_PKEY_RSA) + if (pkey != NULL && pkey->type == EVP_PKEY_RSA) { BIO_printf(bp,"%12sRSA Public Key: (%d bit)\n","", BN_num_bits(pkey->pkey.rsa->n)); @@ -128,7 +128,7 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) else #endif #ifndef NO_DSA - if (pkey->type == EVP_PKEY_DSA) + if (pkey != NULL && pkey->type == EVP_PKEY_DSA) { BIO_printf(bp,"%12sDSA Public Key:\n",""); DSA_print(bp,pkey->pkey.dsa,16); @@ -137,7 +137,8 @@ int X509_REQ_print(BIO *bp, X509_REQ *x) #endif BIO_printf(bp,"%12sUnknown Public Key:\n",""); - EVP_PKEY_free(pkey); + if (pkey != NULL) + EVP_PKEY_free(pkey); /* may not be */ sprintf(str,"%8sAttributes:\n","");