crypto/x509v3/v3_pci.c:145: error: USE_AFTER_FREE
  call to `CRYPTO_free()` eventually accesses memory that was invalidated by call to `free()` on line 131 indirectly during the call to `CRYPTO_realloc()`.
Showing all 12 steps of the trace


crypto/x509v3/v3_pci.c:76:1: invalidation part of the trace starts here
74.   }
75.   
76. > static int process_pci_value(CONF_VALUE *val,
77.                                ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
78.                                ASN1_OCTET_STRING **policy)

crypto/x509v3/v3_pci.c:76:1: parameter `policy` of process_pci_value
  74.   }
  75.   
  76. > static int process_pci_value(CONF_VALUE *val,
  77.                                ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
  78.                                ASN1_OCTET_STRING **policy)

crypto/x509v3/v3_pci.c:131:24: when calling `CRYPTO_realloc` here
  129.               }
  130.   
  131.               tmp_data = OPENSSL_realloc((*policy)->data,
                                ^
  132.                                          (*policy)->length + val_len + 1);
  133.               if (tmp_data) {

crypto/mem.c:168:1: parameter `str` of CRYPTO_realloc
    166.   }
    167.   
    168. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
    169.   {
    170.       if (realloc_impl != NULL && realloc_impl != &CRYPTO_realloc)

crypto/mem.c:177:9: when calling `CRYPTO_free` here
    175.   
    176.       if (num == 0) {
    177.           CRYPTO_free(str, file, line);
                   ^
    178.           return NULL;
    179.       }

crypto/mem.c:225:1: parameter `str` of CRYPTO_free
      223.   }
      224.   
      225. > void CRYPTO_free(void *str, const char *file, int line)
      226.   {
      227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

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

crypto/x509v3/v3_pci.c:76:1: use-after-lifetime part of the trace starts here
74.   }
75.   
76. > static int process_pci_value(CONF_VALUE *val,
77.                                ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
78.                                ASN1_OCTET_STRING **policy)

crypto/x509v3/v3_pci.c:76:1: parameter `policy` of process_pci_value
  74.   }
  75.   
  76. > static int process_pci_value(CONF_VALUE *val,
  77.                                ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
  78.                                ASN1_OCTET_STRING **policy)

crypto/x509v3/v3_pci.c:145:17: when calling `CRYPTO_free` here
  143.                    * too!
  144.                    */
  145.                   OPENSSL_free((*policy)->data);
                         ^
  146.                   (*policy)->data = NULL;
  147.                   (*policy)->length = 0;

crypto/mem.c:225:1: parameter `str` of CRYPTO_free
    223.   }
    224.   
    225. > void CRYPTO_free(void *str, const char *file, int line)
    226.   {
    227.       if (free_impl != NULL && free_impl != &CRYPTO_free) {

crypto/mem.c:241:5: invalid access occurs here
    239.       }
    240.   #else
    241.       free(str);
               ^
    242.   #endif
    243.   }
