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


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

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

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

crypto/ec/ec_key.c:438:1: start of procedure EC_KEY_get0_group()
  436.   }
  437.   
  438. > const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
  439.   {
  440.       return key->group;

crypto/ec/ec_key.c:440:5: 
  438.   const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)
  439.   {
  440. >     return key->group;
  441.   }
  442.   

crypto/ec/ec_key.c:441:1: return from a call to EC_KEY_get0_group
  439.   {
  440.       return key->group;
  441. > }
  442.   
  443.   int EC_KEY_set_group(EC_KEY *key, const EC_GROUP *group)

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

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

crypto/ec/ec_lib.c:383:1: start of procedure EC_GROUP_get_asn1_flag()
  381.   }
  382.   
  383. > int EC_GROUP_get_asn1_flag(const EC_GROUP *group)
  384.   {
  385.       return group->asn1_flag;

crypto/ec/ec_lib.c:385:5: 
  383.   int EC_GROUP_get_asn1_flag(const EC_GROUP *group)
  384.   {
  385. >     return group->asn1_flag;
  386.   }
  387.   

crypto/ec/ec_lib.c:386:1: return from a call to EC_GROUP_get_asn1_flag
  384.   {
  385.       return group->asn1_flag;
  386. > }
  387.   
  388.   void EC_GROUP_set_point_conversion_form(EC_GROUP *group,

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

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

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

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

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

static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)
{
    const EC_GROUP *group;
    int nid;
    if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) {
        ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS);
        return 0;
    }
    if (EC_GROUP_get_asn1_flag(group)
        && (nid = EC_GROUP_get_curve_name(group)))
    {
        *ppval = OBJ_nid2obj(nid);
        *pptype = V_ASN1_OBJECT;
    } else {
        ASN1_STRING *pstr = NULL;
        pstr = ASN1_STRING_new();
        if (pstr == NULL)
            return 0;
        pstr->length = i2d_ECParameters(ec_key, &pstr->data);
        if (pstr->length <= 0) {
            ASN1_STRING_free(pstr);
            ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB);
            return 0;
        }
        *ppval = pstr;
        *pptype = V_ASN1_SEQUENCE;
    }
    return 1;
}
['static int eckey_param2type(int *pptype, void **ppval, EC_KEY *ec_key)\n{\n    const EC_GROUP *group;\n    int nid;\n    if (ec_key == NULL || (group = EC_KEY_get0_group(ec_key)) == NULL) {\n        ECerr(EC_F_ECKEY_PARAM2TYPE, EC_R_MISSING_PARAMETERS);\n        return 0;\n    }\n    if (EC_GROUP_get_asn1_flag(group)\n        && (nid = EC_GROUP_get_curve_name(group)))\n    {\n        *ppval = OBJ_nid2obj(nid);\n        *pptype = V_ASN1_OBJECT;\n    } else {\n        ASN1_STRING *pstr = NULL;\n        pstr = ASN1_STRING_new();\n        if (pstr == NULL)\n            return 0;\n        pstr->length = i2d_ECParameters(ec_key, &pstr->data);\n        if (pstr->length <= 0) {\n            ASN1_STRING_free(pstr);\n            ECerr(EC_F_ECKEY_PARAM2TYPE, ERR_R_EC_LIB);\n            return 0;\n        }\n        *ppval = pstr;\n        *pptype = V_ASN1_SEQUENCE;\n    }\n    return 1;\n}', 'const EC_GROUP *EC_KEY_get0_group(const EC_KEY *key)\n{\n    return key->group;\n}', 'int EC_GROUP_get_asn1_flag(const EC_GROUP *group)\n{\n    return group->asn1_flag;\n}', 'ASN1_STRING *ASN1_STRING_new(void)\n{\n    return (ASN1_STRING_type_new(V_ASN1_OCTET_STRING));\n}', 'ASN1_STRING *ASN1_STRING_type_new(int type)\n{\n    ASN1_STRING *ret;\n    ret = OPENSSL_zalloc(sizeof(*ret));\n    if (ret == NULL) {\n        ASN1err(ASN1_F_ASN1_STRING_TYPE_NEW, ERR_R_MALLOC_FAILURE);\n        return (NULL);\n    }\n    ret->type = type;\n    return (ret);\n}', 'void *CRYPTO_zalloc(size_t num, const char *file, int line)\n{\n    void *ret = CRYPTO_malloc(num, file, line);\n    if (ret != NULL)\n        memset(ret, 0, num);\n    return ret;\n}', 'void *CRYPTO_malloc(size_t num, const char *file, int line)\n{\n    void *ret = NULL;\n    if (num <= 0)\n        return NULL;\n    allow_customize = 0;\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_malloc(NULL, num, 0, file, line);\n        ret = malloc(num);\n        CRYPTO_mem_debug_malloc(ret, num, 1, file, line);\n    } else {\n        ret = malloc(num);\n    }\n#else\n    (void)file;\n    (void)line;\n    ret = malloc(num);\n#endif\n#ifndef OPENSSL_CPUID_OBJ\n    if (ret && (num > 2048)) {\n        extern unsigned char cleanse_ctr;\n        ((unsigned char *)ret)[0] = cleanse_ctr;\n    }\n#endif\n    return ret;\n}', 'int i2d_ECParameters(EC_KEY *a, unsigned char **out)\n{\n    if (a == NULL) {\n        ECerr(EC_F_I2D_ECPARAMETERS, ERR_R_PASSED_NULL_PARAMETER);\n        return 0;\n    }\n    return i2d_ECPKParameters(a->group, out);\n}', 'int i2d_ECPKParameters(const EC_GROUP *a, unsigned char **out)\n{\n    int ret = 0;\n    ECPKPARAMETERS *tmp = ec_asn1_group2pkparameters(a, NULL);\n    if (tmp == NULL) {\n        ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_GROUP2PKPARAMETERS_FAILURE);\n        return 0;\n    }\n    if ((ret = i2d_ECPKPARAMETERS(tmp, out)) == 0) {\n        ECerr(EC_F_I2D_ECPKPARAMETERS, EC_R_I2D_ECPKPARAMETERS_FAILURE);\n        ECPKPARAMETERS_free(tmp);\n        return 0;\n    }\n    ECPKPARAMETERS_free(tmp);\n    return (ret);\n}', 'IMPLEMENT_ASN1_FUNCTIONS_const(ECPKPARAMETERS)', 'int ASN1_item_i2d(ASN1_VALUE *val, unsigned char **out, const ASN1_ITEM *it)\n{\n    return asn1_item_flags_i2d(val, out, it, 0);\n}', 'static int asn1_item_flags_i2d(ASN1_VALUE *val, unsigned char **out,\n                               const ASN1_ITEM *it, int flags)\n{\n    if (out && !*out) {\n        unsigned char *p, *buf;\n        int len;\n        len = ASN1_item_ex_i2d(&val, NULL, it, -1, flags);\n        if (len <= 0)\n            return len;\n        buf = OPENSSL_malloc(len);\n        if (buf == NULL)\n            return -1;\n        p = buf;\n        ASN1_item_ex_i2d(&val, &p, it, -1, flags);\n        *out = buf;\n        return len;\n    }\n    return ASN1_item_ex_i2d(&val, out, it, -1, flags);\n}', 'void ASN1_item_free(ASN1_VALUE *val, const ASN1_ITEM *it)\n{\n    asn1_item_embed_free(&val, it, 0);\n}', 'void ASN1_STRING_free(ASN1_STRING *a)\n{\n    if (a == NULL)\n        return;\n    if (!(a->flags & ASN1_STRING_FLAG_NDEF))\n        OPENSSL_free(a->data);\n    if (!(a->flags & ASN1_STRING_FLAG_EMBED))\n        OPENSSL_free(a);\n}']