crypto/stack/stack.c:106: error: USE_AFTER_FREE
  call to `sk_free()` eventually accesses memory that was invalidated by call to `free()` on line 93 indirectly during the call to `CRYPTO_realloc()`.
Showing all 14 steps of the trace


crypto/stack/stack.c:91:10: invalidation part of the trace starts here
89.       char **s;
90.   
91.       if ((ret = sk_new(sk->comp)) == NULL)
               ^
92.           goto err;
93.       s = OPENSSL_realloc((char *)ret->data,

crypto/stack/stack.c:91:10: assigned
  89.       char **s;
  90.   
  91.       if ((ret = sk_new(sk->comp)) == NULL)
                 ^
  92.           goto err;
  93.       s = OPENSSL_realloc((char *)ret->data,

crypto/stack/stack.c:93:9: when calling `CRYPTO_realloc` here
  91.       if ((ret = sk_new(sk->comp)) == NULL)
  92.           goto err;
  93.       s = OPENSSL_realloc((char *)ret->data,
                ^
  94.                           (unsigned int)sizeof(char *) * sk->num_alloc);
  95.       if (s == NULL)

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/stack/stack.c:91:10: use-after-lifetime part of the trace starts here
89.       char **s;
90.   
91.       if ((ret = sk_new(sk->comp)) == NULL)
               ^
92.           goto err;
93.       s = OPENSSL_realloc((char *)ret->data,

crypto/stack/stack.c:91:10: assigned
  89.       char **s;
  90.   
  91.       if ((ret = sk_new(sk->comp)) == NULL)
                 ^
  92.           goto err;
  93.       s = OPENSSL_realloc((char *)ret->data,

crypto/stack/stack.c:106:5: when calling `sk_free` here
  104.       return (ret);
  105.    err:
  106.       sk_free(ret);
             ^
  107.       return (NULL);
  108.   }

crypto/stack/stack.c:308:1: parameter `st` of sk_free
    306.   }
    307.   
    308. > void sk_free(_STACK *st)
    309.   {
    310.       if (st == NULL)

crypto/stack/stack.c:312:5: when calling `CRYPTO_free` here
    310.       if (st == NULL)
    311.           return;
    312.       OPENSSL_free(st->data);
               ^
    313.       OPENSSL_free(st);
    314.   }

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.   }
