crypto/x509v3/v3_conf.c:216: error: MEMORY_LEAK
  memory dynamically allocated by call to `CRYPTO_malloc()` at line 195, column 24 is not reachable after line 216, column 5.
Showing all 78 steps of the trace


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

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

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

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

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

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

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

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

crypto/mem.c:123:9: Taking false branch
  121.       void *ret = NULL;
  122.   
  123.       if (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)
                 ^
  124.           return malloc_impl(num, file, line);
  125.   

crypto/mem.c:126:9: Taking false branch
  124.           return malloc_impl(num, file, line);
  125.   
  126.       if (num <= 0)
                 ^
  127.           return NULL;
  128.   

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

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

crypto/mem.c:139:24: 
  137.       }
  138.   #else
  139. >     osslargused(file); osslargused(line);
  140.       ret = malloc(num);
  141.   #endif

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

crypto/objects/obj_dat.c:301:9: 
    299.           ad.obj = &ob;
    300.           ob.nid = n;
    301. >         adp = lh_ADDED_OBJ_retrieve(added, &ad);
    302.           if (adp != NULL)
    303.               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:216:1: start of procedure lh_retrieve()
        214.   }
        215.   
        216. > void *lh_retrieve(_LHASH *lh, const void *data)
        217.   {
        218.       unsigned long hash;

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

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

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

crypto/lhash/lhash.c:226:9: 
        224.   
        225.       if (*rn == NULL) {
        226. >         lh->num_retrieve_miss++;
        227.           return (NULL);
        228.       } else {

crypto/lhash/lhash.c:227:9: 
        225.       if (*rn == NULL) {
        226.           lh->num_retrieve_miss++;
        227. >         return (NULL);
        228.       } else {
        229.           ret = (*rn)->data;

crypto/lhash/lhash.c:233:1: return from a call to lh_retrieve
        231.       }
        232.       return (ret);
        233. > }
        234.   
        235.   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:302:13: Taking false branch
    300.           ob.nid = n;
    301.           adp = lh_ADDED_OBJ_retrieve(added, &ad);
    302.           if (adp != NULL)
                       ^
    303.               return (adp->obj);
    304.           else {

crypto/objects/obj_dat.c:305:13: Skipping ERR_put_error(): empty list of specs
    303.               return (adp->obj);
    304.           else {
    305.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);
                       ^
    306.               return (NULL);
    307.           }

crypto/objects/obj_dat.c:306:13: 
    304.           else {
    305.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);
    306. >             return (NULL);
    307.           }
    308.       }

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

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

crypto/x509/x509_v3.c:192:9: Skipping ERR_put_error(): empty list of specs
  190.       obj = OBJ_nid2obj(nid);
  191.       if (obj == NULL) {
  192.           X509err(X509_F_X509_EXTENSION_CREATE_BY_NID, X509_R_UNKNOWN_NID);
                 ^
  193.           return (NULL);
  194.       }

crypto/x509/x509_v3.c:193:9: 
  191.       if (obj == NULL) {
  192.           X509err(X509_F_X509_EXTENSION_CREATE_BY_NID, X509_R_UNKNOWN_NID);
  193. >         return (NULL);
  194.       }
  195.       ret = X509_EXTENSION_create_by_OBJ(ex, obj, crit, data);

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

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

crypto/x509v3/v3_conf.c:213:2: 
211.       return ext;
212.   
213. >  merr:
214.       X509V3err(X509V3_F_DO_EXT_I2D, ERR_R_MALLOC_FAILURE);
215.       OPENSSL_free(ext_der);

crypto/x509v3/v3_conf.c:214:5: Skipping ERR_put_error(): empty list of specs
212.   
213.    merr:
214.       X509V3err(X509V3_F_DO_EXT_I2D, ERR_R_MALLOC_FAILURE);
           ^
215.       OPENSSL_free(ext_der);
216.       ASN1_OCTET_STRING_free(ext_oct);

crypto/x509v3/v3_conf.c:215:5: 
213.    merr:
214.       X509V3err(X509V3_F_DO_EXT_I2D, ERR_R_MALLOC_FAILURE);
215. >     OPENSSL_free(ext_der);
216.       ASN1_OCTET_STRING_free(ext_oct);
217.       return NULL;

crypto/mem.c:222:1: start of procedure CRYPTO_free()
  220.   }
  221.   
  222. > void CRYPTO_free(void *str, const char *file, int line)
  223.   {
  224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:224:9: Taking true branch
  222.   void CRYPTO_free(void *str, const char *file, int line)
  223.   {
  224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                 ^
  225.           free_impl(str, file, line);
  226.           return;

crypto/mem.c:224:30: Taking true branch
  222.   void CRYPTO_free(void *str, const char *file, int line)
  223.   {
  224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                                      ^
  225.           free_impl(str, file, line);
  226.           return;

crypto/mem.c:225:9: Skipping __function_pointer__(): unresolved function pointer
  223.   {
  224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  225.           free_impl(str, file, line);
                 ^
  226.           return;
  227.       }

crypto/mem.c:226:9: 
  224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
  225.           free_impl(str, file, line);
  226. >         return;
  227.       }
  228.   

crypto/mem.c:240:1: return from a call to CRYPTO_free
  238.       free(str);
  239.   #endif
  240. > }
  241.   
  242.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

crypto/x509v3/v3_conf.c:216:5: 
214.       X509V3err(X509V3_F_DO_EXT_I2D, ERR_R_MALLOC_FAILURE);
215.       OPENSSL_free(ext_der);
216. >     ASN1_OCTET_STRING_free(ext_oct);
217.       return NULL;
218.   

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

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

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

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

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

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

crypto/mem.c:222:1: start of procedure CRYPTO_free()
      220.   }
      221.   
      222. > void CRYPTO_free(void *str, const char *file, int line)
      223.   {
      224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:224:9: Taking false branch
      222.   void CRYPTO_free(void *str, const char *file, int line)
      223.   {
      224.       if (free_impl != NULL && free_impl != &CRYPTO_free) {
                     ^
      225.           free_impl(str, file, line);
      226.           return;

crypto/mem.c:238:5: 
      236.       }
      237.   #else
      238. >     free(str);
      239.   #endif
      240.   }

crypto/mem.c:240:1: return from a call to CRYPTO_free
      238.       free(str);
      239.   #endif
      240. > }
      241.   
      242.   void CRYPTO_clear_free(void *str, size_t num, const char *file, int line)

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

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

crypto/asn1/tasn_typ.c:76:1: return from a call to ASN1_OCTET_STRING_free
  74.   }
  75.   
  76. > IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_OCTET_STRING)
  77.   IMPLEMENT_ASN1_STRING_FUNCTIONS(ASN1_INTEGER)
  78.   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 (malloc_impl != NULL && malloc_impl != CRYPTO_malloc)\n        return malloc_impl(num, file, line);\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    osslargused(file); osslargused(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)', '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 CRYPTO_free(void *str, const char *file, int line)\n{\n    if (free_impl != NULL && free_impl != &CRYPTO_free) {\n        free_impl(str, file, line);\n        return;\n    }\n#ifndef OPENSSL_NO_CRYPTO_MDEBUG\n    if (call_malloc_debug) {\n        CRYPTO_mem_debug_free(str, 0, file, line);\n        free(str);\n        CRYPTO_mem_debug_free(str, 1, file, line);\n    } else {\n        free(str);\n    }\n#else\n    free(str);\n#endif\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}']