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

src/core/ngx_resolver.c:195:1: invalidation part of the trace starts here
193. 
194. 
195. static void
     ^
196. ngx_resolver_cleanup_tree(ngx_resolver_t *r, ngx_rbtree_t *tree)
197. {

src/core/ngx_resolver.c:195:1: parameter `tree` of ngx_resolver_cleanup_tree
  193. 
  194. 
  195. static void
       ^
  196. ngx_resolver_cleanup_tree(ngx_resolver_t *r, ngx_rbtree_t *tree)
  197. {

src/core/ngx_resolver.c:203:38: passed as argument to `ngx_rbtree_min`
  201.     while (tree->root != tree->sentinel) {
  202. 
  203.         rn = (ngx_resolver_node_t *) ngx_rbtree_min(tree->root, tree->sentinel);
                                            ^
  204. 
  205.         ngx_queue_remove(&rn->queue);

src/core/ngx_resolver.c:203:38: return from call to `ngx_rbtree_min`
  201.     while (tree->root != tree->sentinel) {
  202. 
  203.         rn = (ngx_resolver_node_t *) ngx_rbtree_min(tree->root, tree->sentinel);
                                            ^
  204. 
  205.         ngx_queue_remove(&rn->queue);

src/core/ngx_resolver.c:203:9: assigned
  201.     while (tree->root != tree->sentinel) {
  202. 
  203.         rn = (ngx_resolver_node_t *) ngx_rbtree_min(tree->root, tree->sentinel);
               ^
  204. 
  205.         ngx_queue_remove(&rn->queue);

src/core/ngx_resolver.c:219:9: when calling `ngx_resolver_free_node` here
  217.         ngx_rbtree_delete(tree, &rn->node);
  218. 
  219.         ngx_resolver_free_node(r, rn);
               ^
  220.     }
  221. }

src/core/ngx_resolver.c:1964:1: parameter `rn` of ngx_resolver_free_node
    1962. 
    1963. 
    1964. static void
          ^
    1965. ngx_resolver_free_node(ngx_resolver_t *r, ngx_resolver_node_t *rn)
    1966. {

src/core/ngx_resolver.c:1985:5: when calling `ngx_resolver_free_locked` here
    1983.     }
    1984. 
    1985.     ngx_resolver_free_locked(r, rn);
              ^
    1986. 
    1987.     /* unlock alloc mutex */

src/core/ngx_resolver.c:2032:1: parameter `p` of ngx_resolver_free_locked
      2030. 
      2031. 
      2032. static void
            ^
      2033. ngx_resolver_free_locked(ngx_resolver_t *r, void *p)
      2034. {

src/core/ngx_resolver.c:2035:5: was invalidated by call to `free()`
      2033. ngx_resolver_free_locked(ngx_resolver_t *r, void *p)
      2034. {
      2035.     ngx_free(p);
                ^
      2036. }
      2037. 

src/core/ngx_resolver.c:195:1: use-after-lifetime part of the trace starts here
193. 
194. 
195. static void
     ^
196. ngx_resolver_cleanup_tree(ngx_resolver_t *r, ngx_rbtree_t *tree)
197. {

src/core/ngx_resolver.c:195:1: parameter `tree` of ngx_resolver_cleanup_tree
  193. 
  194. 
  195. static void
       ^
  196. ngx_resolver_cleanup_tree(ngx_resolver_t *r, ngx_rbtree_t *tree)
  197. {

src/core/ngx_resolver.c:203:38: when calling `ngx_rbtree_min` here
  201.     while (tree->root != tree->sentinel) {
  202. 
  203.         rn = (ngx_resolver_node_t *) ngx_rbtree_min(tree->root, tree->sentinel);
                                            ^
  204. 
  205.         ngx_queue_remove(&rn->queue);

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

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