src/core/ngx_resolver.c:247: error: Use After Free
  call to `ngx_rbtree_min()` eventually accesses memory that was invalidated by call to `free()` on line 263 indirectly during the call to `ngx_resolver_free_node()`.

src/core/ngx_resolver.c:239:1: invalidation part of the trace starts here
237. 
238. 
239. static void
     ^
240. ngx_resolver_cleanup_tree(ngx_resolver_t *r, ngx_rbtree_t *tree)
241. {

src/core/ngx_resolver.c:239:1: parameter `tree` of ngx_resolver_cleanup_tree
  237. 
  238. 
  239. static void
       ^
  240. ngx_resolver_cleanup_tree(ngx_resolver_t *r, ngx_rbtree_t *tree)
  241. {

src/core/ngx_resolver.c:247:38: passed as argument to `ngx_rbtree_min`
  245.     while (tree->root != tree->sentinel) {
  246. 
  247.         rn = (ngx_resolver_node_t *) ngx_rbtree_min(tree->root, tree->sentinel);
                                            ^
  248. 
  249.         ngx_queue_remove(&rn->queue);

src/core/ngx_resolver.c:247:38: return from call to `ngx_rbtree_min`
  245.     while (tree->root != tree->sentinel) {
  246. 
  247.         rn = (ngx_resolver_node_t *) ngx_rbtree_min(tree->root, tree->sentinel);
                                            ^
  248. 
  249.         ngx_queue_remove(&rn->queue);

src/core/ngx_resolver.c:247:9: assigned
  245.     while (tree->root != tree->sentinel) {
  246. 
  247.         rn = (ngx_resolver_node_t *) ngx_rbtree_min(tree->root, tree->sentinel);
               ^
  248. 
  249.         ngx_queue_remove(&rn->queue);

src/core/ngx_resolver.c:263:9: when calling `ngx_resolver_free_node` here
  261.         ngx_rbtree_delete(tree, &rn->node);
  262. 
  263.         ngx_resolver_free_node(r, rn);
               ^
  264.     }
  265. }

src/core/ngx_resolver.c:2046:1: parameter `rn` of ngx_resolver_free_node
    2044. 
    2045. 
    2046. static void
          ^
    2047. ngx_resolver_free_node(ngx_resolver_t *r, ngx_resolver_node_t *rn)
    2048. {

src/core/ngx_resolver.c:2067:5: when calling `ngx_resolver_free_locked` here
    2065.     }
    2066. 
    2067.     ngx_resolver_free_locked(r, rn);
              ^
    2068. 
    2069.     /* unlock alloc mutex */

src/core/ngx_resolver.c:2114:1: parameter `p` of ngx_resolver_free_locked
      2112. 
      2113. 
      2114. static void
            ^
      2115. ngx_resolver_free_locked(ngx_resolver_t *r, void *p)
      2116. {

src/core/ngx_resolver.c:2117:5: was invalidated by call to `free()`
      2115. ngx_resolver_free_locked(ngx_resolver_t *r, void *p)
      2116. {
      2117.     ngx_free(p);
                ^
      2118. }
      2119. 

src/core/ngx_resolver.c:239:1: use-after-lifetime part of the trace starts here
237. 
238. 
239. static void
     ^
240. ngx_resolver_cleanup_tree(ngx_resolver_t *r, ngx_rbtree_t *tree)
241. {

src/core/ngx_resolver.c:239:1: parameter `tree` of ngx_resolver_cleanup_tree
  237. 
  238. 
  239. static void
       ^
  240. ngx_resolver_cleanup_tree(ngx_resolver_t *r, ngx_rbtree_t *tree)
  241. {

src/core/ngx_resolver.c:247:38: when calling `ngx_rbtree_min` here
  245.     while (tree->root != tree->sentinel) {
  246. 
  247.         rn = (ngx_resolver_node_t *) ngx_rbtree_min(tree->root, tree->sentinel);
                                            ^
  248. 
  249.         ngx_queue_remove(&rn->queue);

src/core/ngx_rbtree.h:73:1: parameter `node` of ngx_rbtree_min
    71. 
    72. 
    73. static ngx_inline ngx_rbtree_node_t *
        ^
    74. ngx_rbtree_min(ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
    75. {

src/core/ngx_rbtree.h:76:12: invalid access occurs here
    74. ngx_rbtree_min(ngx_rbtree_node_t *node, ngx_rbtree_node_t *sentinel)
    75. {
    76.     while (node->left != sentinel) {
                   ^
    77.         node = node->left;
    78.     }
