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


crypto/asn1/p5_scrypt.c:122:15: invalidation part of the trace starts here
120.       }
121.   
122.       alg_nid = EVP_CIPHER_type(cipher);
                     ^
123.       if (alg_nid == NID_undef) {
124.           ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT,

crypto/asn1/p5_scrypt.c:122:15: global variable `nid_objs` accessed here
  120.       }
  121.   
  122.       alg_nid = EVP_CIPHER_type(cipher);
                       ^
  123.       if (alg_nid == NID_undef) {
  124.           ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT,

crypto/asn1/p5_scrypt.c:122:15: when calling `EVP_CIPHER_type` here
  120.       }
  121.   
  122.       alg_nid = EVP_CIPHER_type(cipher);
                       ^
  123.       if (alg_nid == NID_undef) {
  124.           ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT,

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

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

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

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

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

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

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

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

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

crypto/asn1/p5_scrypt.c:122:15: use-after-lifetime part of the trace starts here
120.       }
121.   
122.       alg_nid = EVP_CIPHER_type(cipher);
                     ^
123.       if (alg_nid == NID_undef) {
124.           ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT,

crypto/asn1/p5_scrypt.c:122:15: global variable `nid_objs` accessed here
  120.       }
  121.   
  122.       alg_nid = EVP_CIPHER_type(cipher);
                       ^
  123.       if (alg_nid == NID_undef) {
  124.           ASN1err(ASN1_F_PKCS5_PBE2_SET_SCRYPT,

crypto/asn1/p5_scrypt.c:128:11: when calling `OBJ_nid2obj` here
  126.           goto err;
  127.       }
  128.       obj = OBJ_nid2obj(alg_nid);
                   ^
  129.       pbe2 = PBE2PARAM_new();
  130.       if (pbe2 == NULL)

crypto/objects/obj_dat.c:299:34: global variable `nid_objs` accessed here
    297.   
    298.       if ((n >= 0) && (n < NUM_NID)) {
    299.           if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
                                            ^
    300.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);
    301.               return (NULL);

crypto/objects/obj_dat.c:299:34: invalid access occurs here
    297.   
    298.       if ((n >= 0) && (n < NUM_NID)) {
    299.           if ((n != NID_undef) && (nid_objs[n].nid == NID_undef)) {
                                            ^
    300.               OBJerr(OBJ_F_OBJ_NID2OBJ, OBJ_R_UNKNOWN_NID);
    301.               return (NULL);
