crypto/asn1/p5_pbev2.c:106: error: USE_AFTER_FREE
  call to `OBJ_nid2obj()` eventually accesses memory that was invalidated by call to `free()` on line 100 indirectly during the call to `EVP_CIPHER_type()`.
Showing all 17 steps of the trace


crypto/asn1/p5_pbev2.c:100:15: invalidation part of the trace starts here
98.       ASN1_OBJECT *obj;
99.   
100.       alg_nid = EVP_CIPHER_type(cipher);
                     ^
101.       if (alg_nid == NID_undef) {
102.           ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,

crypto/asn1/p5_pbev2.c:100:15: global variable `nid_objs` accessed here
  98.       ASN1_OBJECT *obj;
  99.   
  100.       alg_nid = EVP_CIPHER_type(cipher);
                       ^
  101.       if (alg_nid == NID_undef) {
  102.           ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,

crypto/asn1/p5_pbev2.c:100:15: when calling `EVP_CIPHER_type` here
  98.       ASN1_OBJECT *obj;
  99.   
  100.       alg_nid = EVP_CIPHER_type(cipher);
                       ^
  101.       if (alg_nid == NID_undef) {
  102.           ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,

crypto/evp/evp_lib.c:205:16: global variable `nid_objs` accessed here
    203.       default:
    204.           /* Check it has an OID and it is valid */
    205.           otmp = OBJ_nid2obj(nid);
                          ^
    206.           if (OBJ_get0_data(otmp) == NULL)
    207.               nid = NID_undef;

crypto/evp/evp_lib.c:205:16: passed as argument to `OBJ_nid2obj`
    203.       default:
    204.           /* Check it has an OID and it is valid */
    205.           otmp = OBJ_nid2obj(nid);
                          ^
    206.           if (OBJ_get0_data(otmp) == NULL)
    207.               nid = NID_undef;

crypto/evp/evp_lib.c:205:16: return from call to `OBJ_nid2obj`
    203.       default:
    204.           /* Check it has an OID and it is valid */
    205.           otmp = OBJ_nid2obj(nid);
                          ^
    206.           if (OBJ_get0_data(otmp) == NULL)
    207.               nid = NID_undef;

crypto/evp/evp_lib.c:205:9: assigned
    203.       default:
    204.           /* Check it has an OID and it is valid */
    205.           otmp = OBJ_nid2obj(nid);
                   ^
    206.           if (OBJ_get0_data(otmp) == NULL)
    207.               nid = NID_undef;

crypto/evp/evp_lib.c:208:9: when calling `ASN1_OBJECT_free` here
    206.           if (OBJ_get0_data(otmp) == NULL)
    207.               nid = NID_undef;
    208.           ASN1_OBJECT_free(otmp);
                   ^
    209.           return nid;
    210.       }

crypto/asn1/a_object.c:379:1: parameter `a` of ASN1_OBJECT_free
      377.   }
      378.   
      379. > void ASN1_OBJECT_free(ASN1_OBJECT *a)
      380.   {
      381.       if (a == NULL)

crypto/asn1/a_object.c:398:9: when calling `CRYPTO_free` here
      396.       }
      397.       if (a->flags & ASN1_OBJECT_FLAG_DYNAMIC)
      398.           OPENSSL_free(a);
                     ^
      399.   }
      400.   

crypto/mem.c:233:1: parameter `str` of CRYPTO_free
        231.   }
        232.   
        233. > void CRYPTO_free(void *str)
        234.   {
        235.   #ifndef OPENSSL_NO_CRYPTO_MDEBUG

crypto/mem.c:244:5: was invalidated by call to `free()`
        242.       }
        243.   #else
        244.       free(str);
                   ^
        245.   #endif
        246.   }

crypto/asn1/p5_pbev2.c:100:15: use-after-lifetime part of the trace starts here
98.       ASN1_OBJECT *obj;
99.   
100.       alg_nid = EVP_CIPHER_type(cipher);
                     ^
101.       if (alg_nid == NID_undef) {
102.           ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,

crypto/asn1/p5_pbev2.c:100:15: global variable `nid_objs` accessed here
  98.       ASN1_OBJECT *obj;
  99.   
  100.       alg_nid = EVP_CIPHER_type(cipher);
                       ^
  101.       if (alg_nid == NID_undef) {
  102.           ASN1err(ASN1_F_PKCS5_PBE2_SET_IV,

crypto/asn1/p5_pbev2.c:106:11: when calling `OBJ_nid2obj` here
  104.           goto err;
  105.       }
  106.       obj = OBJ_nid2obj(alg_nid);
                   ^
  107.   
  108.       if ((pbe2 = PBE2PARAM_new()) == NULL)

crypto/objects/obj_dat.c:290:34: global variable `nid_objs` accessed here
    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);
    292.               return (NULL);

crypto/objects/obj_dat.c:290:34: invalid access occurs here
    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);
    292.               return (NULL);
