src/core/ngx_inet.c:716: error: Use After Free
  accessing memory that was invalidated by call to `free()` on line 713.

src/core/ngx_inet.c:704:17: invalidation part of the trace starts here
702. 
703.         if (sin->sin_addr.s_addr == INADDR_NONE) {
704.             p = ngx_alloc(++len, pool->log);
                     ^
705.             if (p == NULL) {
706.                 return NGX_ERROR;

src/core/ngx_inet.c:704:17: passed as argument to `ngx_alloc`
  702. 
  703.         if (sin->sin_addr.s_addr == INADDR_NONE) {
  704.             p = ngx_alloc(++len, pool->log);
                       ^
  705.             if (p == NULL) {
  706.                 return NGX_ERROR;

src/core/ngx_inet.c:704:17: return from call to `ngx_alloc`
  702. 
  703.         if (sin->sin_addr.s_addr == INADDR_NONE) {
  704.             p = ngx_alloc(++len, pool->log);
                       ^
  705.             if (p == NULL) {
  706.                 return NGX_ERROR;

src/core/ngx_inet.c:704:13: assigned
  702. 
  703.         if (sin->sin_addr.s_addr == INADDR_NONE) {
  704.             p = ngx_alloc(++len, pool->log);
                   ^
  705.             if (p == NULL) {
  706.                 return NGX_ERROR;

src/core/ngx_inet.c:713:13: was invalidated by call to `free()`
  711.             h = gethostbyname((const char *) p);
  712. 
  713.             ngx_free(p);
                   ^
  714. 
  715.             if (h == NULL || h->h_addr_list[0] == NULL) {

src/core/ngx_inet.c:704:17: use-after-lifetime part of the trace starts here
702. 
703.         if (sin->sin_addr.s_addr == INADDR_NONE) {
704.             p = ngx_alloc(++len, pool->log);
                     ^
705.             if (p == NULL) {
706.                 return NGX_ERROR;

src/core/ngx_inet.c:704:17: passed as argument to `ngx_alloc`
  702. 
  703.         if (sin->sin_addr.s_addr == INADDR_NONE) {
  704.             p = ngx_alloc(++len, pool->log);
                       ^
  705.             if (p == NULL) {
  706.                 return NGX_ERROR;

src/core/ngx_inet.c:704:17: return from call to `ngx_alloc`
  702. 
  703.         if (sin->sin_addr.s_addr == INADDR_NONE) {
  704.             p = ngx_alloc(++len, pool->log);
                       ^
  705.             if (p == NULL) {
  706.                 return NGX_ERROR;

src/core/ngx_inet.c:704:13: assigned
  702. 
  703.         if (sin->sin_addr.s_addr == INADDR_NONE) {
  704.             p = ngx_alloc(++len, pool->log);
                   ^
  705.             if (p == NULL) {
  706.                 return NGX_ERROR;

src/core/ngx_inet.c:716:17: invalid access occurs here
  714. 
  715.             if (h == NULL || h->h_addr_list[0] == NULL) {
  716.                 ngx_free(p);
                       ^
  717.                 u->err = "host not found";
  718.                 return NGX_ERROR;
