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


crypto/x509v3/v3_pci.c:85:1: invalidation part of the trace starts here
83.   }
84.   
85. > static int process_pci_value(CONF_VALUE *val,
86.                                ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
87.                                ASN1_OCTET_STRING **policy)

crypto/x509v3/v3_pci.c:85:1: parameter `policy` of process_pci_value
  83.   }
  84.   
  85. > static int process_pci_value(CONF_VALUE *val,
  86.                                ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
  87.                                ASN1_OCTET_STRING **policy)

crypto/x509v3/v3_pci.c:138:24: when calling `CRYPTO_realloc` here
  136.               }
  137.   
  138.               tmp_data = OPENSSL_realloc((*policy)->data,
                                ^
  139.                                          (*policy)->length + val_len + 1);
  140.               if (tmp_data) {

crypto/mem.c:228:1: parameter `str` of CRYPTO_realloc
    226.   }
    227.   
    228. > void *CRYPTO_realloc(void *str, size_t num, const char *file, int line)
    229.   {
    230.       INCREMENT(realloc_count);

crypto/mem.c:239:9: when calling `CRYPTO_free` here
    237.   
    238.       if (num == 0) {
    239.           CRYPTO_free(str, file, line);
                   ^
    240.           return NULL;
    241.       }

crypto/mem.c:286:1: parameter `str` of CRYPTO_free
      284.   }
      285.   
      286. > void CRYPTO_free(void *str, const char *file, int line)
      287.   {
      288.       INCREMENT(free_count);

crypto/mem.c:303:5: was invalidated by call to `free()`
      301.       }
      302.   #else
      303.       free(str);
                 ^
      304.   #endif
      305.   }

crypto/x509v3/v3_pci.c:85:1: use-after-lifetime part of the trace starts here
83.   }
84.   
85. > static int process_pci_value(CONF_VALUE *val,
86.                                ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
87.                                ASN1_OCTET_STRING **policy)

crypto/x509v3/v3_pci.c:85:1: parameter `policy` of process_pci_value
  83.   }
  84.   
  85. > static int process_pci_value(CONF_VALUE *val,
  86.                                ASN1_OBJECT **language, ASN1_INTEGER **pathlen,
  87.                                ASN1_OCTET_STRING **policy)

crypto/x509v3/v3_pci.c:152:17: when calling `CRYPTO_free` here
  150.                    * too!
  151.                    */
  152.                   OPENSSL_free((*policy)->data);
                         ^
  153.                   (*policy)->data = NULL;
  154.                   (*policy)->length = 0;

crypto/mem.c:286:1: parameter `str` of CRYPTO_free
    284.   }
    285.   
    286. > void CRYPTO_free(void *str, const char *file, int line)
    287.   {
    288.       INCREMENT(free_count);

crypto/mem.c:303:5: invalid access occurs here
    301.       }
    302.   #else
    303.       free(str);
               ^
    304.   #endif
    305.   }
