crypto/ec/ec_ameth.c:97: error: MEMORY_LEAK
  memory dynamically allocated by call to `ASN1_STRING_new()` at line 92, column 16 is not reachable after line 97, column 13.
Showing all 76 steps of the trace


crypto/ec/ec_ameth.c:75:1: start of procedure eckey_param2type()
73.   #endif
74.   
75. > static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
76.   {
77.       const EC_GROUP *group;

crypto/ec/ec_ameth.c:79:9: Taking false branch
77.       const EC_GROUP *group;
78.       int nid;
79.       if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) {
              ^
80.           ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS);
81.           return 0;

crypto/ec/ec_ameth.c:79:27: 
77.       const EC_GROUP *group;
78.       int nid;
79. >     if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) {
80.           ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS);
81.           return 0;

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.   

crypto/ec/ec_key.c:453:1: return from a call to EC_KEY_get0_group
  451.   {
  452.       return key->group;
  453. > }
  454.   
  455.   int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)

crypto/ec/ec_ameth.c:79:27: Taking false branch
77.       const EC_GROUP *group;
78.       int nid;
79.       if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) {
                                ^
80.           ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS);
81.           return 0;

crypto/ec/ec_ameth.c:83:9: 
81.           return 0;
82.       }
83. >     if (EC_GROUP_get_asn1_flag(group)
84.           && (nid = EC_GROUP_get_curve_name(group)))
85.           /* we have a 'named curve' => just set the OID */

crypto/ec/ec_lib.c:345:1: start of procedure EC_GROUP_get_asn1_flag()
  343.   }
  344.   
  345. > int EC_GROUP_get_asn1_flag(const EC_GROUP *group)
  346.   {
  347.       return group->asn1_flag;

crypto/ec/ec_lib.c:347:5: 
  345.   int EC_GROUP_get_asn1_flag(const EC_GROUP *group)
  346.   {
  347. >     return group->asn1_flag;
  348.   }
  349.   

crypto/ec/ec_lib.c:348:1: return from a call to EC_GROUP_get_asn1_flag
  346.   {
  347.       return group->asn1_flag;
  348. > }
  349.   
  350.   void EC_GROUP_set_point_conversion_form(EC_GROUP *group,

crypto/ec/ec_ameth.c:83:9: Taking false branch
81.           return 0;
82.       }
83.       if (EC_GROUP_get_asn1_flag(group)
              ^
84.           && (nid = EC_GROUP_get_curve_name(group)))
85.           /* we have a 'named curve' => just set the OID */

crypto/ec/ec_ameth.c:91:9: 
89.       } else {                    /* explicit parameters */
90.   
91. >         ASN1_STRING *pstr = NULL;
92.           pstr = ASN1_STRING_new();
93.           if (pstr == NULL)

crypto/ec/ec_ameth.c:92:9: 
90.   
91.           ASN1_STRING *pstr = NULL;
92. >         pstr = ASN1_STRING_new();
93.           if (pstr == NULL)
94.               return 0;

crypto/asn1/asn1_lib.c:344:1: start of procedure ASN1_STRING_new()
  342.   }
  343.   
  344. > ASN1_STRING *ASN1_STRING_new(void)
  345.   {
  346.       return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));

crypto/asn1/asn1_lib.c:346:5: 
  344.   ASN1_STRING *ASN1_STRING_new(void)
  345.   {
  346. >     return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));
  347.   }
  348.   

crypto/asn1/asn1_lib.c:349:1: start of procedure ASN1_STRING_type_new()
    347.   }
    348.   
    349. > ASN1_STRING *ASN1_STRING_type_new(int type)
    350.   {
    351.       ASN1_STRING *ret;

crypto/asn1/asn1_lib.c:353:5: 
    351.       ASN1_STRING *ret;
    352.   
    353. >     ret = OPENSSL_zalloc(sizeof(*ret));
    354.       if (ret == NULL) {
    355.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);

crypto/mem.c:157:1: start of procedure CRYPTO_zalloc()
      155.   }
      156.   
      157. > void *CRYPTO_zalloc(size_t num, const char *file, int line)
      158.   {
      159.       void *ret = CRYPTO_malloc(num, file, line);

crypto/mem.c:159:5: 
      157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)
      158.   {
      159. >     void *ret = CRYPTO_malloc(num, file, line);
      160.   
      161.       if (ret != NULL)

crypto/mem.c:120:1: start of procedure CRYPTO_malloc()
        118.   }
        119.   
        120. > void *CRYPTO_malloc(size_t num, const char *file, int line)
        121.   {
        122.       void *ret = NULL;

crypto/mem.c:122:5: 
        120.   void *CRYPTO_malloc(size_t num, const char *file, int line)
        121.   {
        122. >     void *ret = NULL;
        123.   
        124.       if (num <= 0)

crypto/mem.c:124:9: Taking false branch
        122.       void *ret = NULL;
        123.   
        124.       if (num <= 0)
                       ^
        125.           return NULL;
        126.   

crypto/mem.c:127:5: 
        125.           return NULL;
        126.   
        127. >     allow_customize = 0;
        128.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG
        129.       if (call_malloc_debug) {

crypto/mem.c:137:5: 
        135.       }
        136.   #else
        137. >     (void)file;
        138.       (void)line;
        139.       ret = malloc(num);

crypto/mem.c:138:5: 
        136.   #else
        137.       (void)file;
        138. >     (void)line;
        139.       ret = malloc(num);
        140.   #endif

crypto/mem.c:139:5: 
        137.       (void)file;
        138.       (void)line;
        139. >     ret = malloc(num);
        140.   #endif
        141.   

crypto/mem.c:154:5: 
        152.   #endif
        153.   
        154. >     return ret;
        155.   }
        156.   

crypto/mem.c:155:1: return from a call to CRYPTO_malloc
        153.   
        154.       return ret;
        155. > }
        156.   
        157.   void *CRYPTO_zalloc(size_t num, const char *file, int line)

crypto/mem.c:161:9: Taking true branch
      159.       void *ret = CRYPTO_malloc(num, file, line);
      160.   
      161.       if (ret != NULL)
                     ^
      162.           memset(ret, 0, num);
      163.       return ret;

crypto/mem.c:162:9: 
      160.   
      161.       if (ret != NULL)
      162. >         memset(ret, 0, num);
      163.       return ret;
      164.   }

crypto/mem.c:163:5: 
      161.       if (ret != NULL)
      162.           memset(ret, 0, num);
      163. >     return ret;
      164.   }
      165.   

crypto/mem.c:164:1: return from a call to CRYPTO_zalloc
      162.           memset(ret, 0, num);
      163.       return ret;
      164. > }
      165.   
      166.   void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)

crypto/asn1/asn1_lib.c:354:9: Taking false branch
    352.   
    353.       ret = OPENSSL_zalloc(sizeof(*ret));
    354.       if (ret == NULL) {
                   ^
    355.           ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);
    356.           return (NULL);

crypto/asn1/asn1_lib.c:358:5: 
    356.           return (NULL);
    357.       }
    358. >     ret->type = type;
    359.       return (ret);
    360.   }

crypto/asn1/asn1_lib.c:359:5: 
    357.       }
    358.       ret->type = type;
    359. >     return (ret);
    360.   }
    361.   

crypto/asn1/asn1_lib.c:360:1: return from a call to ASN1_STRING_type_new
    358.       ret->type = type;
    359.       return (ret);
    360. > }
    361.   
    362.   void ASN1_STRING_free(ASN1_STRING *a)

crypto/asn1/asn1_lib.c:347:1: return from a call to ASN1_STRING_new
  345.   {
  346.       return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));
  347. > }
  348.   
  349.   ASN1_STRING *ASN1_STRING_type_new(int type)

crypto/ec/ec_ameth.c:93:13: Taking false branch
91.           ASN1_STRING *pstr = NULL;
92.           pstr = ASN1_STRING_new();
93.           if (pstr == NULL)
                  ^
94.               return 0;
95.           pstr->length = i2d_ECParameters(ec_key, &pstr->data);

crypto/ec/ec_ameth.c:95:9: 
93.           if (pstr == NULL)
94.               return 0;
95. >         pstr->length = i2d_ECParameters(ec_key, &pstr->data);
96.           if (pstr->length <= 0) {
97.               ASN1_STRING_free(pstr);

crypto/ec/ec_asn1.c:1194:1: start of procedure i2d_ECParameters()
  1192.   }
  1193.   
  1194. > int i2d_ECParameters(EC_KEY *a, unsigned char **out)
  1195.   {
  1196.       if (a == NULL) {

crypto/ec/ec_asn1.c:1196:9: Taking false branch
  1194.   int i2d_ECParameters(EC_KEY *a, unsigned char **out)
  1195.   {
  1196.       if (a == NULL) {
                  ^
  1197.           ECerr(EC_F_I2D_ECPARAMETERS, ERR_R_PASSED_NULL_PARAMETER);
  1198.           return 0;

crypto/ec/ec_asn1.c:1200:5: 
  1198.           return 0;
  1199.       }
  1200. >     return i2d_ECPKParameters(a->group, out);
  1201.   }
  1202.   

crypto/ec/ec_asn1.c:970:1: start of procedure i2d_ECPKParameters()
    968.   }
    969.   
    970. > int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out)
    971.   {
    972.       int ret = 0;

crypto/ec/ec_asn1.c:972:5: 
    970.   int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out)
    971.   {
    972. >     int ret = 0;
    973.       ECPKPARAMETERS *tmp = ec_asn1_group2pkparameters(a, NULL);
    974.       if (tmp == NULL) {

crypto/ec/ec_asn1.c:973:5: Skipping ec_asn1_group2pkparameters(): empty list of specs
    971.   {
    972.       int ret = 0;
    973.       ECPKPARAMETERS *tmp = ec_asn1_group2pkparameters(a, NULL);
               ^
    974.       if (tmp == NULL) {
    975.           ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_GROUP2PKPARAMETERS_FAILURE);

crypto/ec/ec_asn1.c:974:9: Taking false branch
    972.       int ret = 0;
    973.       ECPKPARAMETERS *tmp = ec_asn1_group2pkparameters(a, NULL);
    974.       if (tmp == NULL) {
                   ^
    975.           ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_GROUP2PKPARAMETERS_FAILURE);
    976.           return 0;

crypto/ec/ec_asn1.c:978:9: 
    976.           return 0;
    977.       }
    978. >     if ((ret = i2d_ECPKPARAMETERS(tmp, out)) == 0) {
    979.           ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_I2D_ECPKPARAMETERS_FAILURE);
    980.           ECPKPARAMETERS_free(tmp);

crypto/ec/ec_asn1.c:267:1: start of procedure i2d_ECPKPARAMETERS()
      265.   DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
      266.   DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS)
      267. > IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
      268.   
      269.   ASN1_SEQUENCE(EC_PRIVATEKEY) = {

crypto/asn1/tasn_enc.c:92:1: start of procedure ASN1_item_i2d()
        90.   }
        91.   
        92. > int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
        93.   {
        94.       return asn1_item_flags_i2d(val, out, it, 0);

crypto/asn1/tasn_enc.c:94:5: 
        92.   int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)
        93.   {
        94. >     return asn1_item_flags_i2d(val, out, it, 0);
        95.   }
        96.   

crypto/asn1/tasn_enc.c:104:1: start of procedure asn1_item_flags_i2d()
          102.    */
          103.   
          104. > static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,
          105.                                  const ASN1_ITEM *it, int flags)
          106.   {

crypto/asn1/tasn_enc.c:107:9: Taking true branch
          105.                                  const ASN1_ITEM *it, int flags)
          106.   {
          107.       if (out && !*out) {
                         ^
          108.           unsigned char *p, *buf;
          109.           int len;

crypto/asn1/tasn_enc.c:107:17: Taking false branch
          105.                                  const ASN1_ITEM *it, int flags)
          106.   {
          107.       if (out && !*out) {
                                 ^
          108.           unsigned char *p, *buf;
          109.           int len;

crypto/asn1/tasn_enc.c:122:5: Skipping ASN1_item_ex_i2d(): empty list of specs
          120.       }
          121.   
          122.       return ASN1_item_ex_i2d(&val, out, it, -1, flags);
                     ^
          123.   }
          124.   

crypto/asn1/tasn_enc.c:123:1: return from a call to asn1_item_flags_i2d
          121.   
          122.       return ASN1_item_ex_i2d(&val, out, it, -1, flags);
          123. > }
          124.   
          125.   /*

crypto/asn1/tasn_enc.c:95:1: return from a call to ASN1_item_i2d
        93.   {
        94.       return asn1_item_flags_i2d(val, out, it, 0);
        95. > }
        96.   
        97.   /*

crypto/ec/ec_asn1.c:267:1: return from a call to i2d_ECPKPARAMETERS
      265.   DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
      266.   DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS)
      267. > IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
      268.   
      269.   ASN1_SEQUENCE(EC_PRIVATEKEY) = {

crypto/ec/ec_asn1.c:978:9: Taking false branch
    976.           return 0;
    977.       }
    978.       if ((ret = i2d_ECPKPARAMETERS(tmp, out)) == 0) {
                   ^
    979.           ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_I2D_ECPKPARAMETERS_FAILURE);
    980.           ECPKPARAMETERS_free(tmp);

crypto/ec/ec_asn1.c:983:5: 
    981.           return 0;
    982.       }
    983. >     ECPKPARAMETERS_free(tmp);
    984.       return (ret);
    985.   }

crypto/ec/ec_asn1.c:267:1: start of procedure ECPKPARAMETERS_free()
      265.   DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
      266.   DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS)
      267. > IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
      268.   
      269.   ASN1_SEQUENCE(EC_PRIVATEKEY) = {

crypto/asn1/tasn_fre.c:71:1: start of procedure ASN1_item_free()
        69.   /* Free up an ASN1 structure */
        70.   
        71. > void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
        72.   {
        73.       asn1_item_embed_free(&val, it, 0);

crypto/asn1/tasn_fre.c:73:5: Skipping asn1_item_embed_free(): empty list of specs
        71.   void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)
        72.   {
        73.       asn1_item_embed_free(&val, it, 0);
                  ^
        74.   }
        75.   

crypto/asn1/tasn_fre.c:74:1: return from a call to ASN1_item_free
        72.   {
        73.       asn1_item_embed_free(&val, it, 0);
        74. > }
        75.   
        76.   void ASN1_item_ex_free(ASN1_VALUE **pval, const ASN1_ITEM *it)

crypto/ec/ec_asn1.c:267:1: return from a call to ECPKPARAMETERS_free
      265.   DECLARE_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
      266.   DECLARE_ASN1_ENCODE_FUNCTIONS_const(ECPKPARAMETERS, ECPKPARAMETERS)
      267. > IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS)
      268.   
      269.   ASN1_SEQUENCE(EC_PRIVATEKEY) = {

crypto/ec/ec_asn1.c:984:5: 
    982.       }
    983.       ECPKPARAMETERS_free(tmp);
    984. >     return (ret);
    985.   }
    986.   

crypto/ec/ec_asn1.c:985:1: return from a call to i2d_ECPKParameters
    983.       ECPKPARAMETERS_free(tmp);
    984.       return (ret);
    985. > }
    986.   
    987.   /* some EC_KEY functions */

crypto/ec/ec_asn1.c:1201:1: return from a call to i2d_ECParameters
  1199.       }
  1200.       return i2d_ECPKParameters(a->group, out);
  1201. > }
  1202.   
  1203.   EC_KEY *d2i_ECParameters(EC_KEY **a, const unsigned char **in, long len)

crypto/ec/ec_ameth.c:96:13: Taking true branch
94.               return 0;
95.           pstr->length = i2d_ECParameters(ec_key, &pstr->data);
96.           if (pstr->length <= 0) {
                  ^
97.               ASN1_STRING_free(pstr);
98.               ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB);

crypto/ec/ec_ameth.c:97:13: 
95.           pstr->length = i2d_ECParameters(ec_key, &pstr->data);
96.           if (pstr->length <= 0) {
97. >             ASN1_STRING_free(pstr);
98.               ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB);
99.               return 0;

crypto/asn1/asn1_lib.c:362:1: start of procedure ASN1_STRING_free()
  360.   }
  361.   
  362. > void ASN1_STRING_free(ASN1_STRING *a)
  363.   {
  364.       if (a == NULL)

crypto/asn1/asn1_lib.c:364:9: Taking false branch
  362.   void ASN1_STRING_free(ASN1_STRING *a)
  363.   {
  364.       if (a == NULL)
                 ^
  365.           return;
  366.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))

crypto/asn1/asn1_lib.c:366:11: Taking false branch
  364.       if (a == NULL)
  365.           return;
  366.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
                   ^
  367.           OPENSSL_free(a->data);
  368.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))

crypto/asn1/asn1_lib.c:368:11: Taking false branch
  366.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
  367.           OPENSSL_free(a->data);
  368.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))
                   ^
  369.           OPENSSL_free(a);
  370.   }

crypto/asn1/asn1_lib.c:368:5: 
  366.       if (!(a->flags & ASN1_STRING_FLAG_NDEF))
  367.           OPENSSL_free(a->data);
  368. >     if (!(a->flags & ASN1_STRING_FLAG_EMBED))
  369.           OPENSSL_free(a);
  370.   }

crypto/asn1/asn1_lib.c:370:1: return from a call to ASN1_STRING_free
  368.       if (!(a->flags & ASN1_STRING_FLAG_EMBED))
  369.           OPENSSL_free(a);
  370. > }
  371.   
  372.   void ASN1_STRING_clear_free(ASN1_STRING *a)
