crypto/x509v3/v3_conf.c:210: error: MEMORY_LEAK
  memory dynamically allocated by call to `ASN1_OCTET_STRING_new()` at line 201, column 20 is not reachable after line 210, column 5.
Showing all 85 steps of the trace


crypto/x509v3/v3_conf.c:178:1: start of procedure do_ext_i2d()
176.   }
177.   
178. > static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method,
179.                                     int ext_nid, int crit, void *ext_struc)
180.   {

crypto/x509v3/v3_conf.c:181:5: 
179.                                     int ext_nid, int crit, void *ext_struc)
180.   {
181. >     unsigned char *ext_der = NULL;
182.       int ext_len;
183.       ASN1_OCTET_STRING *ext_oct = NULL;

crypto/x509v3/v3_conf.c:183:5: 
181.       unsigned char *ext_der = NULL;
182.       int ext_len;
183. >     ASN1_OCTET_STRING *ext_oct = NULL;
184.       X509_EXTENSION *ext;
185.       /* Convert internal representation to DER */

crypto/x509v3/v3_conf.c:186:9: Taking false branch
184.       X509_EXTENSION *ext;
185.       /* Convert internal representation to DER */
186.       if (method->it) {
               ^
187.           ext_der = NULL;
188.           ext_len =

crypto/x509v3/v3_conf.c:195:9: Skipping __function_pointer__(): unresolved function pointer
193.           unsigned char *p;
194.   
195.           ext_len = method->i2d(ext_struc, NULL);
               ^
196.           if ((ext_der = OPENSSL_malloc(ext_len)) == NULL)
197.               goto merr;

crypto/x509v3/v3_conf.c:196:13: 
194.   
195.           ext_len = method->i2d(ext_struc, NULL);
196. >         if ((ext_der = OPENSSL_malloc(ext_len)) == NULL)
197.               goto merr;
198.           p = ext_der;

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/x509v3/v3_conf.c:196:13: Taking false branch
194.   
195.           ext_len = method->i2d(ext_struc, NULL);
196.           if ((ext_der = OPENSSL_malloc(ext_len)) == NULL)
                   ^
197.               goto merr;
198.           p = ext_der;

crypto/x509v3/v3_conf.c:198:9: 
196.           if ((ext_der = OPENSSL_malloc(ext_len)) == NULL)
197.               goto merr;
198. >         p = ext_der;
199.           method->i2d(ext_struc, &p);
200.       }

crypto/x509v3/v3_conf.c:199:9: Skipping __function_pointer__(): unresolved function pointer
197.               goto merr;
198.           p = ext_der;
199.           method->i2d(ext_struc, &p);
               ^
200.       }
201.       if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL)

crypto/x509v3/v3_conf.c:201:9: 
199.           method->i2d(ext_struc, &p);
200.       }
201. >     if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL)
202.           goto merr;
203.       ext_oct->data = ext_der;

crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_OCTET_STRING_new()
  75.   }
  76.   
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)

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/tasn_typ.c:77:1: return from a call to ASN1_OCTET_STRING_new
  75.   }
  76.   
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)

crypto/x509v3/v3_conf.c:201:9: Taking false branch
199.           method->i2d(ext_struc, &p);
200.       }
201.       if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL)
               ^
202.           goto merr;
203.       ext_oct->data = ext_der;

crypto/x509v3/v3_conf.c:203:5: 
201.       if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL)
202.           goto merr;
203. >     ext_oct->data = ext_der;
204.       ext_der = NULL;
205.       ext_oct->length = ext_len;

crypto/x509v3/v3_conf.c:204:5: 
202.           goto merr;
203.       ext_oct->data = ext_der;
204. >     ext_der = NULL;
205.       ext_oct->length = ext_len;
206.   

crypto/x509v3/v3_conf.c:205:5: 
203.       ext_oct->data = ext_der;
204.       ext_der = NULL;
205. >     ext_oct->length = ext_len;
206.   
207.       ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct);

crypto/x509v3/v3_conf.c:207:5: 
205.       ext_oct->length = ext_len;
206.   
207. >     ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct);
208.       if (!ext)
209.           goto merr;

crypto/x509/x509_v3.c:184:1: start of procedure X509_EXTENSION_create_by_NID()
  182.   }
  183.   
  184. > X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, int nid,
  185.                                                int crit,
  186.                                                ASN1_OCTET_STRING *data)

crypto/x509/x509_v3.c:191:5: 
  189.       X509_EXTENSION *ret;
  190.   
  191. >     obj = OBJ_nid2obj(nid);
  192.       if (obj == NULL) {
  193.           X509err(X509_F_X509_EXTENSION_CREATE_BY_NID, X509_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:285:1: start of procedure OBJ_nid2obj()
    283.   }
    284.   
    285. > ASN1_OBJECT *OBJ_nid2obj(int n)
    286.   {
    287.       ADDED_OBJ ad, *adp;

crypto/objects/obj_dat.c:290:10: Taking true branch
    288.       ASN1_OBJECT ob;
    289.   
    290.       if ((n >= 0) && (n < NUM_NID)) {
                    ^
    291.           if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
    292.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:290:22: Taking false branch
    288.       ASN1_OBJECT ob;
    289.   
    290.       if ((n >= 0) && (n < NUM_NID)) {
                                ^
    291.           if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
    292.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:296:16: Taking false branch
    294.           }
    295.           return ((ASN1_OBJECT *)&(nid_objs[n]));
    296.       } else if (added == NULL)
                          ^
    297.           return (NULL);
    298.       else {

crypto/objects/obj_dat.c:299:9: 
    297.           return (NULL);
    298.       else {
    299. >         ad.type = ADDED_NID;
    300.           ad.obj = &ob;
    301.           ob.nid = n;

crypto/objects/obj_dat.c:300:9: 
    298.       else {
    299.           ad.type = ADDED_NID;
    300. >         ad.obj = &ob;
    301.           ob.nid = n;
    302.           adp = lh_ADDED_OBJ_retrieve(added, &ad);

crypto/objects/obj_dat.c:301:9: 
    299.           ad.type = ADDED_NID;
    300.           ad.obj = &ob;
    301. >         ob.nid = n;
    302.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    303.           if (adp != NULL)

crypto/objects/obj_dat.c:302:9: 
    300.           ad.obj = &ob;
    301.           ob.nid = n;
    302. >         adp = lh_ADDED_OBJ_retrieve(added, &ad);
    303.           if (adp != NULL)
    304.               return (adp->obj);

crypto/objects/obj_lcl.h:7:1: start of procedure lh_ADDED_OBJ_retrieve()
      5.   DEFINE_LHASH_OF(OBJ_NAME);
      6.   typedef struct added_obj_st ADDED_OBJ;
      7. > DEFINE_LHASH_OF(ADDED_OBJ);

crypto/lhash/lhash.c:217:1: start of procedure lh_retrieve()
        215.   }
        216.   
        217. > void *lh_retrieve(_LHASH *lh, const void *data)
        218.   {
        219.       unsigned long hash;

crypto/lhash/lhash.c:223:5: 
        221.       void *ret;
        222.   
        223. >     lh->error = 0;
        224.       rn = getrn(lh, data, &hash);
        225.   

crypto/lhash/lhash.c:224:5: Skipping getrn(): empty list of specs
        222.   
        223.       lh->error = 0;
        224.       rn = getrn(lh, data, &hash);
                   ^
        225.   
        226.       if (*rn == NULL) {

crypto/lhash/lhash.c:226:9: Taking false branch
        224.       rn = getrn(lh, data, &hash);
        225.   
        226.       if (*rn == NULL) {
                       ^
        227.           lh->num_retrieve_miss++;
        228.           return (NULL);

crypto/lhash/lhash.c:230:9: 
        228.           return (NULL);
        229.       } else {
        230. >         ret = (*rn)->data;
        231.           lh->num_retrieve++;
        232.       }

crypto/lhash/lhash.c:231:9: 
        229.       } else {
        230.           ret = (*rn)->data;
        231. >         lh->num_retrieve++;
        232.       }
        233.       return (ret);

crypto/lhash/lhash.c:233:5: 
        231.           lh->num_retrieve++;
        232.       }
        233. >     return (ret);
        234.   }
        235.   

crypto/lhash/lhash.c:234:1: return from a call to lh_retrieve
        232.       }
        233.       return (ret);
        234. > }
        235.   
        236.   static void doall_util_fn(_LHASH *lh, int use_arg, LHASH_DOALL_FN_TYPE func,

crypto/objects/obj_lcl.h:7:1: return from a call to lh_ADDED_OBJ_retrieve
      5.   DEFINE_LHASH_OF(OBJ_NAME);
      6.   typedef struct added_obj_st ADDED_OBJ;
      7. > DEFINE_LHASH_OF(ADDED_OBJ);

crypto/objects/obj_dat.c:303:13: Taking true branch
    301.           ob.nid = n;
    302.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    303.           if (adp != NULL)
                       ^
    304.               return (adp->obj);
    305.           else {

crypto/objects/obj_dat.c:304:13: 
    302.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    303.           if (adp != NULL)
    304. >             return (adp->obj);
    305.           else {
    306.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);

crypto/objects/obj_dat.c:310:1: return from a call to OBJ_nid2obj
    308.           }
    309.       }
    310. > }
    311.   
    312.   const char *OBJ_nid2sn(int n)

crypto/x509/x509_v3.c:192:9: Taking false branch
  190.   
  191.       obj = OBJ_nid2obj(nid);
  192.       if (obj == NULL) {
                 ^
  193.           X509err(X509_F_X509_EXTENSION_CREATE_BY_NID, X509_R_UNKNOWN_NID);
  194.           return (NULL);

crypto/x509/x509_v3.c:196:5: Skipping X509_EXTENSION_create_by_OBJ(): empty list of specs
  194.           return (NULL);
  195.       }
  196.       ret = X509_EXTENSION_create_by_OBJ(ex, obj, crit, data);
             ^
  197.       if (ret == NULL)
  198.           ASN1_OBJECT_free(obj);

crypto/x509/x509_v3.c:197:9: Taking false branch
  195.       }
  196.       ret = X509_EXTENSION_create_by_OBJ(ex, obj, crit, data);
  197.       if (ret == NULL)
                 ^
  198.           ASN1_OBJECT_free(obj);
  199.       return (ret);

crypto/x509/x509_v3.c:199:5: 
  197.       if (ret == NULL)
  198.           ASN1_OBJECT_free(obj);
  199. >     return (ret);
  200.   }
  201.   

crypto/x509/x509_v3.c:200:1: return from a call to X509_EXTENSION_create_by_NID
  198.           ASN1_OBJECT_free(obj);
  199.       return (ret);
  200. > }
  201.   
  202.   X509_EXTENSION *X509_EXTENSION_create_by_OBJ(X509_EXTENSION **ex,

crypto/x509v3/v3_conf.c:208:10: Taking false branch
206.   
207.       ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct);
208.       if (!ext)
                ^
209.           goto merr;
210.       ASN1_OCTET_STRING_free(ext_oct);

crypto/x509v3/v3_conf.c:210:5: 
208.       if (!ext)
209.           goto merr;
210. >     ASN1_OCTET_STRING_free(ext_oct);
211.   
212.       return ext;

crypto/asn1/tasn_typ.c:77:1: start of procedure ASN1_OCTET_STRING_free()
  75.   }
  76.   
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)

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)

crypto/asn1/tasn_typ.c:77:1: return from a call to ASN1_OCTET_STRING_free
  75.   }
  76.   
  77. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  78.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  79.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_ENUMERATED)

static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method,
                                  int ext_nid, int crit, void *ext_struc)
{
    unsigned char *ext_der = NULL;
    int ext_len;
    ASN1_OCTET_STRING *ext_oct = NULL;
    X509_EXTENSION *ext;
    if (method->it) {
        ext_der = NULL;
        ext_len =
            ASN1_item_i2d(ext_struc, &ext_der, ASN1_ITEM_ptr(method->it));
        if (ext_len < 0)
            goto merr;
    } else {
        unsigned char *p;
        ext_len = method->i2d(ext_struc, NULL);
        if ((ext_der = OPENSSL_malloc(ext_len)) == NULL)
            goto merr;
        p = ext_der;
        method->i2d(ext_struc, &p);
    }
    if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL)
        goto merr;
    ext_oct->data = ext_der;
    ext_der = NULL;
    ext_oct->length = ext_len;
    ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct);
    if (!ext)
        goto merr;
    ASN1_OCTET_STRING_free(ext_oct);
    return ext;
 merr:
    X509V3err(X509V3_F_DO_EXT_I2D, ERR_R_MALLOC_FAILURE);
    OPENSSL_free(ext_der);
    ASN1_OCTET_STRING_free(ext_oct);
    return NULL;
}
['static X509_EXTENSION *do_ext_i2d(const X509V3_EXT_METHOD *method,\n                                  int ext_nid, int crit, void *ext_struc)\n{\n    unsigned char *ext_der = NULL;\n    int ext_len;\n    ASN1_OCTET_STRING *ext_oct = NULL;\n    X509_EXTENSION *ext;\n    if (method->it) {\n        ext_der = NULL;\n        ext_len =\n            ASN1_item_i2d(ext_struc, &ext_der, ASN1_ITEM_ptr(method->it));\n        if (ext_len < 0)\n            goto merr;\n    } else {\n        unsigned char *p;\n        ext_len = method->i2d(ext_struc, NULL);\n        if ((ext_der = OPENSSL_malloc(ext_len)) == NULL)\n            goto merr;\n        p = ext_der;\n        method->i2d(ext_struc, &p);\n    }\n    if ((ext_oct = ASN1_OCTET_STRING_new()) == NULL)\n        goto merr;\n    ext_oct->data = ext_der;\n    ext_der = NULL;\n    ext_oct->length = ext_len;\n    ext = X509_EXTENSION_create_by_NID(NULL, ext_nid, crit, ext_oct);\n    if (!ext)\n        goto merr;\n    ASN1_OCTET_STRING_free(ext_oct);\n    return ext;\n merr:\n    X509V3err(X509V3_F_DO_EXT_I2D, ERR_R_MALLOC_FAILURE);\n    OPENSSL_free(ext_der);\n    ASN1_OCTET_STRING_free(ext_oct);\n    return NULL;\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}', 'IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)', '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}', 'X509_EXTENSION *X509_EXTENSION_create_by_NID(X509_EXTENSION **ex, int nid,\n                                             int crit,\n                                             ASN1_OCTET_STRING *data)\n{\n    ASN1_OBJECT *obj;\n    X509_EXTENSION *ret;\n    obj = OBJ_nid2obj(nid);\n    if (obj == NULL) {\n        X509err(X509_F_X509_EXTENSION_CREATE_BY_NID, X509_R_UNKNOWN_NID);\n        return (NULL);\n    }\n    ret = X509_EXTENSION_create_by_OBJ(ex, obj, crit, data);\n    if (ret == NULL)\n        ASN1_OBJECT_free(obj);\n    return (ret);\n}', 'ASN1_OBJECT *OBJ_nid2obj(int n)\n{\n    ADDED_OBJ ad, *adp;\n    ASN1_OBJECT ob;\n    if ((n >= 0) && (n < NUM_NID)) {\n        if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {\n            OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);\n            return (NULL);\n        }\n        return ((ASN1_OBJECT *)&(nid_objs[n]));\n    } else if (added == NULL)\n        return (NULL);\n    else {\n        ad.type = ADDED_NID;\n        ad.obj = &ob;\n        ob.nid = n;\n        adp = lh_ADDED_OBJ_retrieve(added, &ad);\n        if (adp != NULL)\n            return (adp->obj);\n        else {\n            OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);\n            return (NULL);\n        }\n    }\n}', 'DEFINE_LHASH_OF(ADDED_OBJ)', 'void *lh_retrieve(_LHASH *lh, const void *data)\n{\n    unsigned long hash;\n    LHASH_NODE **rn;\n    void *ret;\n    lh->error = 0;\n    rn = getrn(lh, data, &hash);\n    if (*rn == NULL) {\n        lh->num_retrieve_miss++;\n        return (NULL);\n    } else {\n        ret = (*rn)->data;\n        lh->num_retrieve++;\n    }\n    return (ret);\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}']