test/ssltest.c:842: error: NULL_DEREFERENCE
  pointer `ec` last assigned on line 839 could be null and is dereferenced by call to `EC_KEY_get0_group()` at line 842, column 39.
Showing all 19 steps of the trace


test/ssltest.c:834:1: start of procedure print_key_details()
832.   }
833.   
834. > static void print_key_details(BIO *out, EVP_PKEY *key)
835.   {
836.       int keyid = EVP_PKEY_id(key);

test/ssltest.c:836:5: 
834.   static void print_key_details(BIO *out, EVP_PKEY *key)
835.   {
836. >     int keyid = EVP_PKEY_id(key);
837.   #ifndef OPENSSL_NO_EC
838.       if (keyid == EVP_PKEY_EC) {

crypto/evp/p_lib.c:410:1: start of procedure EVP_PKEY_id()
  408.   }
  409.   
  410. > int EVP_PKEY_id(const EVP_PKEY *pkey)
  411.   {
  412.       return pkey->type;

crypto/evp/p_lib.c:412:5: 
  410.   int EVP_PKEY_id(const EVP_PKEY *pkey)
  411.   {
  412. >     return pkey->type;
  413.   }
  414.   

crypto/evp/p_lib.c:413:1: return from a call to EVP_PKEY_id
  411.   {
  412.       return pkey->type;
  413. > }
  414.   
  415.   int EVP_PKEY_base_id(const EVP_PKEY *pkey)

test/ssltest.c:838:9: Taking true branch
836.       int keyid = EVP_PKEY_id(key);
837.   #ifndef OPENSSL_NO_EC
838.       if (keyid == EVP_PKEY_EC) {
               ^
839.           EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key);
840.           int nid;

test/ssltest.c:839:9: 
837.   #ifndef OPENSSL_NO_EC
838.       if (keyid == EVP_PKEY_EC) {
839. >         EC_KEY *ec = EVP_PKEY_get1_EC_KEY(key);
840.           int nid;
841.           const char *cname;

crypto/evp/p_lib.c:356:1: start of procedure EVP_PKEY_get1_EC_KEY()
  354.   }
  355.   
  356. > EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey)
  357.   {
  358.       EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey);

crypto/evp/p_lib.c:358:5: 
  356.   EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey)
  357.   {
  358. >     EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey);
  359.       if (ret != NULL)
  360.           EC_KEY_up_ref(ret);

crypto/evp/p_lib.c:347:1: start of procedure EVP_PKEY_get0_EC_KEY()
    345.   }
    346.   
    347. > EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey)
    348.   {
    349.       if (pkey->type != EVP_PKEY_EC) {

crypto/evp/p_lib.c:349:9: Taking false branch
    347.   EC_KEY *EVP_PKEY_get0_EC_KEY(EVP_PKEY *pkey)
    348.   {
    349.       if (pkey->type != EVP_PKEY_EC) {
                   ^
    350.           EVPerr(EVP_F_EVP_PKEY_GET0_EC_KEY, EVP_R_EXPECTING_A_EC_KEY);
    351.           return NULL;

crypto/evp/p_lib.c:353:5: 
    351.           return NULL;
    352.       }
    353. >     return pkey->pkey.ec;
    354.   }
    355.   

crypto/evp/p_lib.c:354:1: return from a call to EVP_PKEY_get0_EC_KEY
    352.       }
    353.       return pkey->pkey.ec;
    354. > }
    355.   
    356.   EC_KEY *EVP_PKEY_get1_EC_KEY(EVP_PKEY *pkey)

crypto/evp/p_lib.c:359:9: Taking false branch
  357.   {
  358.       EC_KEY *ret = EVP_PKEY_get0_EC_KEY(pkey);
  359.       if (ret != NULL)
                 ^
  360.           EC_KEY_up_ref(ret);
  361.       return ret;

crypto/evp/p_lib.c:361:5: 
  359.       if (ret != NULL)
  360.           EC_KEY_up_ref(ret);
  361. >     return ret;
  362.   }
  363.   #endif

crypto/evp/p_lib.c:362:1: return from a call to EVP_PKEY_get1_EC_KEY
  360.           EC_KEY_up_ref(ret);
  361.       return ret;
  362. > }
  363.   #endif
  364.   

test/ssltest.c:842:9: 
840.           int nid;
841.           const char *cname;
842. >         nid = EC_GROUP_get_curve_name(EC_KEY_get0_group(ec));
843.           EC_KEY_free(ec);
844.           cname = EC_curve_nid2nist(nid);

crypto/ec/ec_key.c:450:1: start of procedure EC_KEY_get0_group()
  448.   }
  449.   
  450. > const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
  451.   {
  452.       return key->group;

crypto/ec/ec_key.c:452:5: 
  450.   const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
  451.   {
  452. >     return key->group;
  453.   }
  454.   
