LLVMFuzzerTestOneInput:
   18|    411|int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   19|    411|  apr_pool_t *pool;
   20|    411|  apr_pool_initialize();
   21|    411|  if (apr_pool_create(&pool, NULL) != APR_SUCCESS) {
  ------------------
  |  |  301|    411|    apr_pool_create_ex(newpool, parent, NULL, NULL)
  ------------------
                if (apr_pool_create(&pool, NULL) != APR_SUCCESS) {
  ------------------
  |  |  225|    411|#define APR_SUCCESS 0
  ------------------
  |  Branch (21:7): [True: 0, False: 411]
  ------------------
   22|      0|    abort();
   23|      0|  }
   24|       |
   25|    411|  char *addr = NULL;
   26|    411|  char *scope_id = NULL;
   27|    411|  apr_port_t port = 0;
   28|    411|  char *input_string = strndup((const char *)data, size);
   29|       |
   30|    411|  apr_parse_addr_port(&addr, &scope_id, &port, input_string, pool);
   31|       |
   32|    411|  free(input_string);
   33|    411|  apr_pool_destroy(pool);
   34|    411|  apr_pool_terminate();
   35|       |
   36|    411|  return 0;
   37|    411|}

apr_atomic_init:
   29|    411|{
   30|       |#if defined (NEED_ATOMICS_GENERIC64)
   31|       |    return apr__atomic_generic64_init(p);
   32|       |#else
   33|    411|    return APR_SUCCESS;
  ------------------
  |  |  225|    411|#define APR_SUCCESS 0
  ------------------
   34|    411|#endif
   35|    411|}

apr_thread_mutex_create:
   40|    411|{
   41|    411|    apr_thread_mutex_t *new_mutex;
   42|    411|    apr_status_t rv;
   43|       |
   44|       |#ifndef HAVE_PTHREAD_MUTEX_RECURSIVE
   45|       |    if (flags & APR_THREAD_MUTEX_NESTED) {
   46|       |        return APR_ENOTIMPL;
   47|       |    }
   48|       |#endif
   49|       |
   50|    411|    new_mutex = apr_pcalloc(pool, sizeof(apr_thread_mutex_t));
  ------------------
  |  |  454|    411|    apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    411|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    411|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|    411|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   51|    411|    new_mutex->pool = pool;
   52|       |
   53|    411|#ifdef HAVE_PTHREAD_MUTEX_RECURSIVE
   54|    411|    if (flags & APR_THREAD_MUTEX_NESTED) {
  ------------------
  |  |   44|    411|#define APR_THREAD_MUTEX_NESTED   0x1   /**< enable nested (recursive) locks */
  ------------------
  |  Branch (54:9): [True: 411, False: 0]
  ------------------
   55|    411|        pthread_mutexattr_t mattr;
   56|       |
   57|    411|        rv = pthread_mutexattr_init(&mattr);
   58|    411|        if (rv) return rv;
  ------------------
  |  Branch (58:13): [True: 0, False: 411]
  ------------------
   59|       |
   60|    411|        rv = pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
   61|    411|        if (rv) {
  ------------------
  |  Branch (61:13): [True: 0, False: 411]
  ------------------
   62|      0|            pthread_mutexattr_destroy(&mattr);
   63|      0|            return rv;
   64|      0|        }
   65|       |
   66|    411|        rv = pthread_mutex_init(&new_mutex->mutex, &mattr);
   67|       |
   68|    411|        pthread_mutexattr_destroy(&mattr);
   69|    411|    } else
   70|      0|#endif
   71|      0|    {
   72|       |#if defined(APR_THREAD_DEBUG)
   73|       |        pthread_mutexattr_t mattr;
   74|       |
   75|       |        rv = pthread_mutexattr_init(&mattr);
   76|       |        if (rv) return rv;
   77|       |
   78|       |        rv = pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_ERRORCHECK);
   79|       |        if (rv) {
   80|       |            pthread_mutexattr_destroy(&mattr);
   81|       |            return rv;
   82|       |        }
   83|       |
   84|       |        rv = pthread_mutex_init(&new_mutex->mutex, &mattr);
   85|       |
   86|       |        pthread_mutexattr_destroy(&mattr);
   87|       |#else
   88|      0|        rv = pthread_mutex_init(&new_mutex->mutex, NULL);
   89|      0|#endif
   90|      0|    }
   91|       |
   92|    411|    if (rv) {
  ------------------
  |  Branch (92:9): [True: 0, False: 411]
  ------------------
   93|       |#ifdef HAVE_ZOS_PTHREADS
   94|       |        rv = errno;
   95|       |#endif
   96|      0|        return rv;
   97|      0|    }
   98|       |
   99|       |#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
  100|       |    if (flags & APR_THREAD_MUTEX_TIMED) {
  101|       |        rv = apr_thread_cond_create(&new_mutex->cond, pool);
  102|       |        if (rv) {
  103|       |#ifdef HAVE_ZOS_PTHREADS
  104|       |            rv = errno;
  105|       |#endif
  106|       |            pthread_mutex_destroy(&new_mutex->mutex);
  107|       |            return rv;
  108|       |        }
  109|       |    }
  110|       |#endif
  111|       |
  112|    411|    apr_pool_cleanup_register(new_mutex->pool,
  113|    411|                              new_mutex, thread_mutex_cleanup,
  114|    411|                              apr_pool_cleanup_null);
  115|       |
  116|    411|    *mutex = new_mutex;
  117|    411|    return APR_SUCCESS;
  ------------------
  |  |  225|    411|#define APR_SUCCESS 0
  ------------------
  118|    411|}
apr_thread_mutex_lock:
  121|    822|{
  122|    822|    apr_status_t rv;
  123|       |
  124|       |#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
  125|       |    if (mutex->cond) {
  126|       |        apr_status_t rv2;
  127|       |
  128|       |        rv = pthread_mutex_lock(&mutex->mutex);
  129|       |        if (rv) {
  130|       |#ifdef HAVE_ZOS_PTHREADS
  131|       |            rv = errno;
  132|       |#endif
  133|       |            return rv;
  134|       |        }
  135|       |
  136|       |        if (mutex->locked) {
  137|       |            mutex->num_waiters++;
  138|       |            rv = apr_thread_cond_wait(mutex->cond, mutex);
  139|       |            mutex->num_waiters--;
  140|       |        }
  141|       |        else {
  142|       |            mutex->locked = 1;
  143|       |        }
  144|       |
  145|       |        rv2 = pthread_mutex_unlock(&mutex->mutex);
  146|       |        if (rv2 && !rv) {
  147|       |#ifdef HAVE_ZOS_PTHREADS
  148|       |            rv = errno;
  149|       |#else
  150|       |            rv = rv2;
  151|       |#endif
  152|       |        }
  153|       |
  154|       |        return rv;
  155|       |    }
  156|       |#endif
  157|       |
  158|    822|    rv = pthread_mutex_lock(&mutex->mutex);
  159|       |#ifdef HAVE_ZOS_PTHREADS
  160|       |    if (rv) {
  161|       |        rv = errno;
  162|       |    }
  163|       |#endif
  164|       |
  165|    822|    return rv;
  166|    822|}
apr_thread_mutex_unlock:
  302|    822|{
  303|    822|    apr_status_t status;
  304|       |
  305|       |#ifndef HAVE_PTHREAD_MUTEX_TIMEDLOCK
  306|       |    if (mutex->cond) {
  307|       |        status = pthread_mutex_lock(&mutex->mutex);
  308|       |        if (status) {
  309|       |#ifdef HAVE_ZOS_PTHREADS
  310|       |            status = errno;
  311|       |#endif
  312|       |            return status;
  313|       |        }
  314|       |
  315|       |        if (!mutex->locked) {
  316|       |            status = APR_EINVAL;
  317|       |        }
  318|       |        else if (mutex->num_waiters) {
  319|       |            status = apr_thread_cond_signal(mutex->cond);
  320|       |        }
  321|       |        if (status) {
  322|       |            pthread_mutex_unlock(&mutex->mutex);
  323|       |            return status;
  324|       |        }
  325|       |
  326|       |        mutex->locked = 0;
  327|       |    }
  328|       |#endif
  329|       |
  330|    822|    status = pthread_mutex_unlock(&mutex->mutex);
  331|       |#ifdef HAVE_ZOS_PTHREADS
  332|       |    if (status) {
  333|       |        status = errno;
  334|       |    }
  335|       |#endif
  336|       |
  337|    822|    return status;
  338|    822|}
thread_mutex.c:thread_mutex_cleanup:
   24|    411|{
   25|    411|    apr_thread_mutex_t *mutex = data;
   26|    411|    apr_status_t rv;
   27|       |
   28|    411|    rv = pthread_mutex_destroy(&mutex->mutex);
   29|       |#ifdef HAVE_ZOS_PTHREADS
   30|       |    if (rv) {
   31|       |        rv = errno;
   32|       |    }
   33|       |#endif
   34|    411|    return rv;
   35|    411|}

apr_pool_initialize:
 1674|    411|{
 1675|    411|    apr_status_t rv;
 1676|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1677|       |    char *logpath;
 1678|       |    apr_file_t *debug_log = NULL;
 1679|       |#endif
 1680|       |
 1681|    411|    if (apr_pools_initialized++)
  ------------------
  |  Branch (1681:9): [True: 0, False: 411]
  ------------------
 1682|      0|        return APR_SUCCESS;
  ------------------
  |  |  225|      0|#define APR_SUCCESS 0
  ------------------
 1683|       |
 1684|    411|#if defined(_SC_PAGESIZE)
 1685|    411|    boundary_size = sysconf(_SC_PAGESIZE);
 1686|       |#elif defined(WIN32)
 1687|       |    {
 1688|       |        SYSTEM_INFO si;
 1689|       |        GetSystemInfo(&si);
 1690|       |        boundary_size = si.dwPageSize;
 1691|       |    }
 1692|       |#endif
 1693|    411|    boundary_index = 12;
 1694|    411|    while ( (1 << boundary_index) < boundary_size)
  ------------------
  |  Branch (1694:13): [True: 0, False: 411]
  ------------------
 1695|      0|        boundary_index++;
 1696|    411|    boundary_size = (1 << boundary_index);
 1697|       |
 1698|       |    /* Since the debug code works a bit differently then the
 1699|       |     * regular pools code, we ask for a lock here.  The regular
 1700|       |     * pools code has got this lock embedded in the global
 1701|       |     * allocator, a concept unknown to debug mode.
 1702|       |     */
 1703|    411|    if ((rv = apr_pool_create_ex(&global_pool, NULL, NULL,
  ------------------
  |  |  247|    411|    apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
  |  |  248|    411|                             APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    411|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    411|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|    411|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1703:9): [True: 0, False: 411]
  ------------------
 1704|    411|                                 NULL)) != APR_SUCCESS) {
  ------------------
  |  |  225|    411|#define APR_SUCCESS 0
  ------------------
 1705|      0|        return rv;
 1706|      0|    }
 1707|       |
 1708|    411|    apr_pool_tag(global_pool, "APR global pool");
 1709|       |
 1710|    411|    apr_pools_initialized = 1;
 1711|       |
 1712|       |    /* This has to happen here because mutexes might be backed by
 1713|       |     * atomics.  It used to be snug and safe in apr_initialize().
 1714|       |     */
 1715|    411|    if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) {
  ------------------
  |  |  225|    411|#define APR_SUCCESS 0
  ------------------
  |  Branch (1715:9): [True: 0, False: 411]
  ------------------
 1716|      0|        return rv;
 1717|      0|    }
 1718|       |
 1719|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1720|       |    rv = apr_env_get(&logpath, "APR_POOL_DEBUG_LOG", global_pool);
 1721|       |
 1722|       |    /* Don't pass file_stderr directly to apr_file_open() here, since
 1723|       |     * apr_file_open() can call back to apr_pool_log_event() and that
 1724|       |     * may attempt to use then then non-NULL but partially set up file
 1725|       |     * object. */
 1726|       |    if (rv == APR_SUCCESS) {
 1727|       |        apr_file_open(&debug_log, logpath,
 1728|       |                      APR_FOPEN_APPEND|APR_FOPEN_WRITE|APR_FOPEN_CREATE,
 1729|       |                      APR_FPROT_OS_DEFAULT, global_pool);
 1730|       |    }
 1731|       |    else {
 1732|       |        apr_file_open_stderr(&debug_log, global_pool);
 1733|       |    }
 1734|       |
 1735|       |    /* debug_log is now a file handle. */
 1736|       |    file_stderr = debug_log;
 1737|       |
 1738|       |    if (file_stderr) {
 1739|       |        apr_file_printf(file_stderr,
 1740|       |            "POOL DEBUG: [PID"
 1741|       |#if APR_HAS_THREADS
 1742|       |            "/TID"
 1743|       |#endif /* APR_HAS_THREADS */
 1744|       |            "] ACTION  (SIZE      /POOL SIZE /TOTAL SIZE) "
 1745|       |            "POOL       \"TAG\" <__FILE__:__LINE__> PARENT     (ALLOCS/TOTAL ALLOCS/CLEARS)\n");
 1746|       |
 1747|       |        apr_pool_log_event(global_pool, "GLOBAL", __FILE__ ":apr_pool_initialize", 0);
 1748|       |
 1749|       |        /* Add a cleanup handler that sets the debug log file handle
 1750|       |         * to NULL, otherwise we'll try to log the global pool
 1751|       |         * destruction event with predictably disastrous results. */
 1752|       |        apr_pool_cleanup_register(global_pool, NULL,
 1753|       |                                  apr_pool_cleanup_file_stderr,
 1754|       |                                  apr_pool_cleanup_null);
 1755|       |    }
 1756|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1757|       |
 1758|    411|    return APR_SUCCESS;
  ------------------
  |  |  225|    411|#define APR_SUCCESS 0
  ------------------
 1759|    411|}
apr_pool_terminate:
 1762|    411|{
 1763|    411|    if (!apr_pools_initialized)
  ------------------
  |  Branch (1763:9): [True: 0, False: 411]
  ------------------
 1764|      0|        return;
 1765|       |
 1766|    411|    if (--apr_pools_initialized)
  ------------------
  |  Branch (1766:9): [True: 0, False: 411]
  ------------------
 1767|      0|        return;
 1768|       |
 1769|    411|    apr_pool_destroy(global_pool); /* This will also destroy the mutex */
  ------------------
  |  |  388|    411|    apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    411|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    411|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|    411|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1770|    411|    global_pool = NULL;
 1771|       |
 1772|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1773|       |    file_stderr = NULL;
 1774|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1775|    411|}
apr_palloc_debug:
 1823|    616|{
 1824|    616|    void *mem;
 1825|       |
 1826|    616|    apr_pool_check_integrity(pool);
 1827|       |
 1828|    616|    mem = pool_alloc(pool, size);
 1829|       |
 1830|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC)
 1831|       |    apr_pool_log_event(pool, "PALLOC", file_line, 1);
 1832|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC) */
 1833|       |
 1834|    616|    return mem;
 1835|    616|}
apr_pcalloc_debug:
 1839|    411|{
 1840|    411|    void *mem;
 1841|       |
 1842|    411|    apr_pool_check_integrity(pool);
 1843|       |
 1844|    411|    mem = pool_alloc(pool, size);
 1845|    411|    memset(mem, 0, size);
 1846|       |
 1847|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC)
 1848|       |    apr_pool_log_event(pool, "PCALLOC", file_line, 1);
 1849|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC) */
 1850|       |
 1851|    411|    return mem;
 1852|    411|}
apr_pool_destroy_debug:
 1985|    822|{
 1986|    822|#if APR_HAS_THREADS
 1987|    822|    apr_thread_mutex_t *mutex;
 1988|    822|#endif
 1989|       |
 1990|    822|    apr_pool_check_lifetime(pool);
 1991|       |
 1992|    822|    if (pool->joined) {
  ------------------
  |  Branch (1992:9): [True: 0, False: 822]
  ------------------
 1993|       |        /* Joined pools must not be explicitly destroyed; the caller
 1994|       |         * has broken the guarantee. */
 1995|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1996|       |        apr_pool_log_event(pool, "LIFE",
 1997|       |                           __FILE__ ":apr_pool_destroy abort on joined", 0);
 1998|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1999|       |
 2000|      0|        abort();
 2001|      0|    }
 2002|       |
 2003|    822|#if APR_HAS_THREADS
 2004|       |    /* Lock the parent mutex before destroying so that it's not accessed
 2005|       |     * concurrently by apr_pool_walk_tree.
 2006|       |     */
 2007|    822|    mutex = parent_lock(pool);
 2008|    822|#endif
 2009|       |
 2010|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
 2011|       |    apr_pool_log_event(pool, "DESTROY", file_line, 1);
 2012|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
 2013|       |
 2014|    822|    pool_destroy_debug(pool, file_line);
 2015|       |
 2016|    822|#if APR_HAS_THREADS
 2017|       |    /* Unlock the mutex we obtained above */
 2018|    822|    parent_unlock(mutex);
 2019|    822|#endif /* APR_HAS_THREADS */
 2020|    822|}
apr_pool_create_ex_debug:
 2027|    822|{
 2028|    822|    apr_pool_t *pool;
 2029|       |
 2030|    822|    *newpool = NULL;
 2031|       |
 2032|    822|    if (!parent) {
  ------------------
  |  Branch (2032:9): [True: 822, False: 0]
  ------------------
 2033|    822|        parent = global_pool;
 2034|    822|    }
 2035|      0|    else {
 2036|      0|       apr_pool_check_lifetime(parent);
 2037|       |
 2038|      0|       if (!allocator)
  ------------------
  |  Branch (2038:12): [True: 0, False: 0]
  ------------------
 2039|      0|           allocator = parent->allocator;
 2040|      0|    }
 2041|       |
 2042|    822|    if (!abort_fn && parent)
  ------------------
  |  Branch (2042:9): [True: 822, False: 0]
  |  Branch (2042:22): [True: 411, False: 411]
  ------------------
 2043|    411|        abort_fn = parent->abort_fn;
 2044|       |
 2045|    822|    if ((pool = malloc(SIZEOF_POOL_T)) == NULL) {
  ------------------
  |  |  618|    822|#define SIZEOF_POOL_T       APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
  |  |  ------------------
  |  |  |  |  143|    822|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  140|    822|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2045:9): [True: 0, False: 822]
  ------------------
 2046|      0|        if (abort_fn)
  ------------------
  |  Branch (2046:13): [True: 0, False: 0]
  ------------------
 2047|      0|            abort_fn(APR_ENOMEM);
  ------------------
  |  |  687|      0|#define APR_ENOMEM ENOMEM
  ------------------
 2048|       |
 2049|      0|         return APR_ENOMEM;
  ------------------
  |  |  687|      0|#define APR_ENOMEM ENOMEM
  ------------------
 2050|      0|    }
 2051|       |
 2052|    822|    memset(pool, 0, SIZEOF_POOL_T);
  ------------------
  |  |  618|    822|#define SIZEOF_POOL_T       APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
  |  |  ------------------
  |  |  |  |  143|    822|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  140|    822|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2053|       |
 2054|    822|    pool->allocator = allocator;
 2055|    822|    pool->abort_fn = abort_fn;
 2056|    822|    pool->tag = file_line;
 2057|    822|    pool->file_line = file_line;
 2058|       |
 2059|    822|#if APR_HAS_THREADS
 2060|    822|    if (parent == NULL || parent->allocator != allocator) {
  ------------------
  |  Branch (2060:9): [True: 411, False: 411]
  |  Branch (2060:27): [True: 0, False: 411]
  ------------------
 2061|    411|        apr_status_t rv;
 2062|       |
 2063|       |        /* No matter what the creation flags say, always create
 2064|       |         * a lock.  Without it integrity_check and apr_pool_num_bytes
 2065|       |         * blow up (because they traverse pools child lists that
 2066|       |         * possibly belong to another thread, in combination with
 2067|       |         * the pool having no lock).  However, this might actually
 2068|       |         * hide problems like creating a child pool of a pool
 2069|       |         * belonging to another thread.
 2070|       |         */
 2071|    411|        if ((rv = apr_thread_mutex_create(&pool->mutex,
  ------------------
  |  Branch (2071:13): [True: 0, False: 411]
  ------------------
 2072|    411|                APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) {
  ------------------
  |  |   44|    411|#define APR_THREAD_MUTEX_NESTED   0x1   /**< enable nested (recursive) locks */
  ------------------
                              APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) {
  ------------------
  |  |  225|    411|#define APR_SUCCESS 0
  ------------------
 2073|      0|            free(pool);
 2074|      0|            return rv;
 2075|      0|        }
 2076|    411|    }
 2077|    411|    else {
 2078|    411|        pool->mutex = parent->mutex;
 2079|    411|    }
 2080|    822|#endif /* APR_HAS_THREADS */
 2081|       |
 2082|    822|    if ((pool->parent = parent) != NULL) {
  ------------------
  |  Branch (2082:9): [True: 411, False: 411]
  ------------------
 2083|    411|        pool_lock(parent);
 2084|       |
 2085|    411|        if ((pool->sibling = parent->child) != NULL)
  ------------------
  |  Branch (2085:13): [True: 0, False: 411]
  ------------------
 2086|      0|            pool->sibling->ref = &pool->sibling;
 2087|       |
 2088|    411|        parent->child = pool;
 2089|    411|        pool->ref = &parent->child;
 2090|       |
 2091|    411|        pool_unlock(parent);
 2092|    411|    }
 2093|    411|    else {
 2094|    411|        pool->sibling = NULL;
 2095|    411|        pool->ref = NULL;
 2096|    411|    }
 2097|       |
 2098|    822|#if APR_HAS_THREADS
 2099|    822|    pool->owner = apr_os_thread_current();
 2100|    822|#endif /* APR_HAS_THREADS */
 2101|       |#ifdef NETWARE
 2102|       |    pool->owner_proc = (apr_os_proc_t)getnlmhandle();
 2103|       |#endif /* defined(NETWARE) */
 2104|       |
 2105|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
 2106|       |    apr_pool_log_event(pool, "CREATE", file_line, 1);
 2107|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
 2108|       |
 2109|    822|    *newpool = pool;
 2110|       |
 2111|    822|    return APR_SUCCESS;
  ------------------
  |  |  225|    822|#define APR_SUCCESS 0
  ------------------
 2112|    822|}
apr_pool_tag:
 2440|    411|{
 2441|    411|    pool->tag = tag;
 2442|    411|}
apr_pool_cleanup_register:
 2530|    411|{
 2531|    411|    cleanup_t *c = NULL;
 2532|       |
 2533|    411|#if APR_POOL_DEBUG
 2534|    411|    apr_pool_check_integrity(p);
 2535|    411|#endif /* APR_POOL_DEBUG */
 2536|       |
 2537|    411|    if (p != NULL) {
  ------------------
  |  Branch (2537:9): [True: 411, False: 0]
  ------------------
 2538|    411|        if (p->free_cleanups) {
  ------------------
  |  Branch (2538:13): [True: 0, False: 411]
  ------------------
 2539|       |            /* reuse a cleanup structure */
 2540|      0|            c = p->free_cleanups;
 2541|      0|            p->free_cleanups = c->next;
 2542|    411|        } else {
 2543|    411|            c = apr_palloc(p, sizeof(cleanup_t));
  ------------------
  |  |  425|    411|    apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    411|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    411|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|    411|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2544|    411|        }
 2545|    411|        c->data = data;
 2546|    411|        c->plain_cleanup_fn = plain_cleanup_fn;
 2547|    411|        c->child_cleanup_fn = child_cleanup_fn;
 2548|    411|        c->next = p->cleanups;
 2549|    411|        p->cleanups = c;
 2550|    411|    }
 2551|       |
 2552|    411|#if APR_POOL_DEBUG
 2553|    411|    if (!c || !c->plain_cleanup_fn || !c->child_cleanup_fn) {
  ------------------
  |  Branch (2553:9): [True: 0, False: 411]
  |  Branch (2553:15): [True: 0, False: 411]
  |  Branch (2553:39): [True: 0, False: 411]
  ------------------
 2554|      0|        abort();
 2555|      0|    }
 2556|    411|#endif /* APR_POOL_DEBUG */
 2557|    411|}
apr_pool_destroy:
 2965|    411|{
 2966|    411|    apr_pool_destroy_debug(pool, "undefined");
 2967|    411|}
apr_pool_create_ex:
 2979|    411|{
 2980|    411|    return apr_pool_create_ex_debug(newpool, parent,
 2981|    411|                                    abort_fn, allocator,
 2982|    411|                                    "undefined");
 2983|    411|}
apr_pools.c:apr_pool_check_integrity:
 1657|  1.43k|{
 1658|  1.43k|    apr_pool_check_lifetime(pool);
 1659|  1.43k|    apr_pool_check_owner(pool);
 1660|  1.43k|}
apr_pools.c:apr_pool_check_owner:
 1642|  2.26k|{
 1643|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_OWNER)
 1644|       |#if APR_HAS_THREADS
 1645|       |    if (!apr_os_thread_equal(pool->owner, apr_os_thread_current())) {
 1646|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1647|       |        apr_pool_log_event(pool, "THREAD",
 1648|       |                           __FILE__ ":apr_pool_integrity check [owner]", 0);
 1649|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1650|       |        abort();
 1651|       |    }
 1652|       |#endif /* APR_HAS_THREADS */
 1653|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_OWNER) */
 1654|  2.26k|}
apr_pools.c:pool_alloc:
 1783|  1.02k|{
 1784|  1.02k|    debug_node_t *node;
 1785|  1.02k|    void *mem;
 1786|       |
 1787|  1.02k|    if ((mem = malloc(size)) == NULL) {
  ------------------
  |  Branch (1787:9): [True: 0, False: 1.02k]
  ------------------
 1788|      0|        if (pool->abort_fn)
  ------------------
  |  Branch (1788:13): [True: 0, False: 0]
  ------------------
 1789|      0|            pool->abort_fn(APR_ENOMEM);
  ------------------
  |  |  687|      0|#define APR_ENOMEM ENOMEM
  ------------------
 1790|       |
 1791|      0|        return NULL;
 1792|      0|    }
 1793|       |
 1794|  1.02k|    node = pool->nodes;
 1795|  1.02k|    if (node == NULL || node->index == 64) {
  ------------------
  |  Branch (1795:9): [True: 615, False: 412]
  |  Branch (1795:25): [True: 0, False: 412]
  ------------------
 1796|    615|        if ((node = malloc(SIZEOF_DEBUG_NODE_T)) == NULL) {
  ------------------
  |  |  562|    615|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  143|    615|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  140|    615|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1796:13): [True: 0, False: 615]
  ------------------
 1797|      0|            free(mem);
 1798|      0|            if (pool->abort_fn)
  ------------------
  |  Branch (1798:17): [True: 0, False: 0]
  ------------------
 1799|      0|                pool->abort_fn(APR_ENOMEM);
  ------------------
  |  |  687|      0|#define APR_ENOMEM ENOMEM
  ------------------
 1800|       |
 1801|      0|            return NULL;
 1802|      0|        }
 1803|       |
 1804|    615|        memset(node, 0, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  |  562|    615|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  143|    615|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  140|    615|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1805|       |
 1806|    615|        node->next = pool->nodes;
 1807|    615|        pool->nodes = node;
 1808|    615|        node->index = 0;
 1809|    615|    }
 1810|       |
 1811|  1.02k|    node->beginp[node->index] = mem;
 1812|  1.02k|    node->endp[node->index] = (char *)mem + size;
 1813|  1.02k|    node->index++;
 1814|       |
 1815|  1.02k|    pool->stat_alloc++;
 1816|  1.02k|    pool->stat_total_alloc++;
 1817|       |
 1818|  1.02k|    return mem;
 1819|  1.02k|}
apr_pools.c:apr_pool_check_lifetime:
 1616|  2.26k|{
 1617|       |    /* Rule of thumb: use of the global pool is always
 1618|       |     * ok, since the only user is apr_pools.c.  Unless
 1619|       |     * people have searched for the top level parent and
 1620|       |     * started to use that...
 1621|       |     */
 1622|  2.26k|    if (pool == global_pool || global_pool == NULL)
  ------------------
  |  Branch (1622:9): [True: 411, False: 1.84k]
  |  Branch (1622:32): [True: 1.23k, False: 616]
  ------------------
 1623|  1.64k|        return;
 1624|       |
 1625|       |    /* Lifetime
 1626|       |     * This basically checks to see if the pool being used is still
 1627|       |     * a relative to the global pool.  If not it was previously
 1628|       |     * destroyed, in which case we abort().
 1629|       |     */
 1630|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_LIFETIME)
 1631|       |    if (!apr_pool_is_child_of(pool, global_pool)) {
 1632|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1633|       |        apr_pool_log_event(pool, "LIFE",
 1634|       |                           __FILE__ ":apr_pool_integrity check [lifetime]", 0);
 1635|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1636|       |        abort();
 1637|       |    }
 1638|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_LIFETIME) */
 1639|  2.26k|}
apr_pools.c:parent_lock:
 1491|    822|{
 1492|    822|    if (pool->parent) {
  ------------------
  |  Branch (1492:9): [True: 411, False: 411]
  ------------------
 1493|    411|        apr_thread_mutex_lock(pool->parent->mutex);
 1494|    411|        return pool->parent->mutex;
 1495|    411|    }
 1496|    411|    return NULL;
 1497|    822|}
apr_pools.c:pool_clear_debug:
 1862|    822|{
 1863|    822|    debug_node_t *node;
 1864|    822|    apr_size_t index;
 1865|       |
 1866|       |    /* Run pre destroy cleanups */
 1867|    822|    run_cleanups(&pool->pre_cleanups);
 1868|    822|    pool->pre_cleanups = NULL;
 1869|       |
 1870|       |    /*
 1871|       |     * Now that we have given the pre cleanups the chance to kill of any
 1872|       |     * threads using the pool, the owner must be correct.
 1873|       |     */
 1874|    822|    apr_pool_check_owner(pool);
 1875|       |
 1876|       |    /* Destroy the subpools.  The subpools will detach themselves from
 1877|       |     * this pool thus this loop is safe and easy.
 1878|       |     */
 1879|    822|    while (pool->child)
  ------------------
  |  Branch (1879:12): [True: 0, False: 822]
  ------------------
 1880|      0|        pool_destroy_debug(pool->child, file_line);
 1881|       |
 1882|       |    /* Run cleanups */
 1883|    822|    run_cleanups(&pool->cleanups);
 1884|    822|    pool->free_cleanups = NULL;
 1885|    822|    pool->cleanups = NULL;
 1886|       |
 1887|       |    /* If new child pools showed up, this is a reason to raise a flag */
 1888|    822|    if (pool->child)
  ------------------
  |  Branch (1888:9): [True: 0, False: 822]
  ------------------
 1889|      0|        abort();
 1890|       |
 1891|       |    /* Free subprocesses */
 1892|    822|    free_proc_chain(pool->subprocesses);
 1893|    822|    pool->subprocesses = NULL;
 1894|       |
 1895|       |    /* Clear the user data. */
 1896|    822|    pool->user_data = NULL;
 1897|       |
 1898|       |    /* Free the blocks, scribbling over them first to help highlight
 1899|       |     * use-after-free issues. */
 1900|  1.43k|    while ((node = pool->nodes) != NULL) {
  ------------------
  |  Branch (1900:12): [True: 615, False: 822]
  ------------------
 1901|    615|        pool->nodes = node->next;
 1902|       |
 1903|  1.64k|        for (index = 0; index < node->index; index++) {
  ------------------
  |  Branch (1903:25): [True: 1.02k, False: 615]
  ------------------
 1904|  1.02k|            memset(node->beginp[index], POOL_POISON_BYTE,
  ------------------
  |  | 1859|  1.02k|#define POOL_POISON_BYTE 'A'
  ------------------
 1905|  1.02k|                   (char *)node->endp[index] - (char *)node->beginp[index]);
 1906|  1.02k|            free(node->beginp[index]);
 1907|  1.02k|        }
 1908|       |
 1909|    615|        memset(node, POOL_POISON_BYTE, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  | 1859|    615|#define POOL_POISON_BYTE 'A'
  ------------------
                      memset(node, POOL_POISON_BYTE, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  |  562|    615|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  143|    615|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  140|    615|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1910|    615|        free(node);
 1911|    615|    }
 1912|       |
 1913|    822|    pool->stat_alloc = 0;
 1914|    822|    pool->stat_clear++;
 1915|       |
 1916|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
 1917|       |    apr_pool_log_event(pool, "CLEARED", file_line, 1);
 1918|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
 1919|    822|}
apr_pools.c:run_cleanups:
 2684|  1.64k|{
 2685|  1.64k|    cleanup_t *c = *cref;
 2686|       |
 2687|  2.05k|    while (c) {
  ------------------
  |  Branch (2687:12): [True: 411, False: 1.64k]
  ------------------
 2688|    411|        *cref = c->next;
 2689|    411|        (*c->plain_cleanup_fn)((void *)c->data);
 2690|    411|        c = *cref;
 2691|    411|    }
 2692|  1.64k|}
apr_pools.c:free_proc_chain:
 2764|    822|{
 2765|       |    /* Dispose of the subprocesses we've spawned off in the course of
 2766|       |     * whatever it was we're cleaning up now.  This may involve killing
 2767|       |     * some of them off...
 2768|       |     */
 2769|    822|    struct process_chain *pc;
 2770|    822|    int need_timeout = 0;
 2771|    822|    apr_time_t timeout_interval;
 2772|       |
 2773|    822|    if (!procs)
  ------------------
  |  Branch (2773:9): [True: 822, False: 0]
  ------------------
 2774|    822|        return; /* No work.  Whew! */
 2775|       |
 2776|       |    /* First, check to see if we need to do the SIGTERM, sleep, SIGKILL
 2777|       |     * dance with any of the processes we're cleaning up.  If we've got
 2778|       |     * any kill-on-sight subprocesses, ditch them now as well, so they
 2779|       |     * don't waste any more cycles doing whatever it is that they shouldn't
 2780|       |     * be doing anymore.
 2781|       |     */
 2782|       |
 2783|      0|#ifndef NEED_WAITPID
 2784|       |    /* Pick up all defunct processes */
 2785|      0|    for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2785:22): [True: 0, False: 0]
  ------------------
 2786|      0|        if (apr_proc_wait(pc->proc, NULL, NULL, APR_NOWAIT) != APR_CHILD_NOTDONE)
  ------------------
  |  |  454|      0|#define APR_CHILD_NOTDONE  (APR_OS_START_STATUS + 6)
  |  |  ------------------
  |  |  |  |  136|      0|#define APR_OS_START_STATUS    (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      0|#define APR_OS_START_ERROR     20000
  |  |  |  |  ------------------
  |  |  |  |               #define APR_OS_START_STATUS    (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|      0|#define APR_OS_ERRSPACE_SIZE 50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2786:13): [True: 0, False: 0]
  ------------------
 2787|      0|            pc->kill_how = APR_KILL_NEVER;
 2788|      0|    }
 2789|      0|#endif /* !defined(NEED_WAITPID) */
 2790|       |
 2791|      0|    for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2791:22): [True: 0, False: 0]
  ------------------
 2792|      0|#ifndef WIN32
 2793|      0|        if ((pc->kill_how == APR_KILL_AFTER_TIMEOUT)
  ------------------
  |  Branch (2793:13): [True: 0, False: 0]
  ------------------
 2794|      0|            || (pc->kill_how == APR_KILL_ONLY_ONCE)) {
  ------------------
  |  Branch (2794:16): [True: 0, False: 0]
  ------------------
 2795|       |            /*
 2796|       |             * Subprocess may be dead already.  Only need the timeout if not.
 2797|       |             * Note: apr_proc_kill on Windows is TerminateProcess(), which is
 2798|       |             * similar to a SIGKILL, so always give the process a timeout
 2799|       |             * under Windows before killing it.
 2800|       |             */
 2801|      0|            if (apr_proc_kill(pc->proc, SIGTERM) == APR_SUCCESS)
  ------------------
  |  |  225|      0|#define APR_SUCCESS 0
  ------------------
  |  Branch (2801:17): [True: 0, False: 0]
  ------------------
 2802|      0|                need_timeout = 1;
 2803|      0|        }
 2804|      0|        else if (pc->kill_how == APR_KILL_ALWAYS) {
  ------------------
  |  Branch (2804:18): [True: 0, False: 0]
  ------------------
 2805|       |#else /* WIN32 knows only one fast, clean method of killing processes today */
 2806|       |        if (pc->kill_how != APR_KILL_NEVER) {
 2807|       |            need_timeout = 1;
 2808|       |            pc->kill_how = APR_KILL_ALWAYS;
 2809|       |#endif
 2810|      0|            apr_proc_kill(pc->proc, SIGKILL);
 2811|      0|        }
 2812|      0|    }
 2813|       |
 2814|       |    /* Sleep only if we have to. The sleep algorithm grows
 2815|       |     * by a factor of two on each iteration. TIMEOUT_INTERVAL
 2816|       |     * is equal to TIMEOUT_USECS / 64.
 2817|       |     */
 2818|      0|    if (need_timeout) {
  ------------------
  |  Branch (2818:9): [True: 0, False: 0]
  ------------------
 2819|      0|        timeout_interval = TIMEOUT_INTERVAL;
  ------------------
  |  |  106|      0|#define TIMEOUT_INTERVAL   46875
  ------------------
 2820|      0|        apr_sleep(timeout_interval);
 2821|       |
 2822|      0|        do {
 2823|       |            /* check the status of the subprocesses */
 2824|      0|            need_timeout = 0;
 2825|      0|            for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2825:30): [True: 0, False: 0]
  ------------------
 2826|      0|                if (pc->kill_how == APR_KILL_AFTER_TIMEOUT) {
  ------------------
  |  Branch (2826:21): [True: 0, False: 0]
  ------------------
 2827|      0|                    if (apr_proc_wait(pc->proc, NULL, NULL, APR_NOWAIT)
  ------------------
  |  Branch (2827:25): [True: 0, False: 0]
  ------------------
 2828|      0|                            == APR_CHILD_NOTDONE)
  ------------------
  |  |  454|      0|#define APR_CHILD_NOTDONE  (APR_OS_START_STATUS + 6)
  |  |  ------------------
  |  |  |  |  136|      0|#define APR_OS_START_STATUS    (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  117|      0|#define APR_OS_START_ERROR     20000
  |  |  |  |  ------------------
  |  |  |  |               #define APR_OS_START_STATUS    (APR_OS_START_ERROR + APR_OS_ERRSPACE_SIZE)
  |  |  |  |  ------------------
  |  |  |  |  |  |  123|      0|#define APR_OS_ERRSPACE_SIZE 50000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2829|      0|                        need_timeout = 1;		/* subprocess is still active */
 2830|      0|                    else
 2831|      0|                        pc->kill_how = APR_KILL_NEVER;	/* subprocess has exited */
 2832|      0|                }
 2833|      0|            }
 2834|      0|            if (need_timeout) {
  ------------------
  |  Branch (2834:17): [True: 0, False: 0]
  ------------------
 2835|      0|                if (timeout_interval >= TIMEOUT_USECS) {
  ------------------
  |  |  105|      0|#define TIMEOUT_USECS    3000000
  ------------------
  |  Branch (2835:21): [True: 0, False: 0]
  ------------------
 2836|      0|                    break;
 2837|      0|                }
 2838|      0|                apr_sleep(timeout_interval);
 2839|      0|                timeout_interval *= 2;
 2840|      0|            }
 2841|      0|        } while (need_timeout);
  ------------------
  |  Branch (2841:18): [True: 0, False: 0]
  ------------------
 2842|      0|    }
 2843|       |
 2844|       |    /* OK, the scripts we just timed out for have had a chance to clean up
 2845|       |     * --- now, just get rid of them, and also clean up the system accounting
 2846|       |     * goop...
 2847|       |     */
 2848|      0|    for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2848:22): [True: 0, False: 0]
  ------------------
 2849|      0|        if (pc->kill_how == APR_KILL_AFTER_TIMEOUT)
  ------------------
  |  Branch (2849:13): [True: 0, False: 0]
  ------------------
 2850|      0|            apr_proc_kill(pc->proc, SIGKILL);
 2851|      0|    }
 2852|       |
 2853|       |    /* Now wait for all the signaled processes to die */
 2854|      0|    for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2854:22): [True: 0, False: 0]
  ------------------
 2855|      0|        if (pc->kill_how != APR_KILL_NEVER)
  ------------------
  |  Branch (2855:13): [True: 0, False: 0]
  ------------------
 2856|      0|            (void)apr_proc_wait(pc->proc, NULL, NULL, APR_WAIT);
 2857|      0|    }
 2858|      0|}
apr_pools.c:parent_unlock:
 1501|    822|{
 1502|    822|    if (mutex) {
  ------------------
  |  Branch (1502:9): [True: 411, False: 411]
  ------------------
 1503|    411|        apr_thread_mutex_unlock(mutex);
 1504|    411|    }
 1505|    822|}
apr_pools.c:pool_destroy_debug:
 1964|    822|{
 1965|    822|    pool_clear_debug(pool, file_line);
 1966|       |
 1967|       |    /* Remove the pool from the parent's child list */
 1968|    822|    if (pool->parent != NULL
  ------------------
  |  Branch (1968:9): [True: 411, False: 411]
  ------------------
 1969|    822|        && (*pool->ref = pool->sibling) != NULL) {
  ------------------
  |  Branch (1969:12): [True: 0, False: 411]
  ------------------
 1970|      0|        pool->sibling->ref = pool->ref;
 1971|      0|    }
 1972|       |
 1973|       |    /* Destroy the allocator if the pool owns it */
 1974|    822|    if (pool->allocator != NULL
  ------------------
  |  Branch (1974:9): [True: 0, False: 822]
  ------------------
 1975|    822|        && apr_allocator_owner_get(pool->allocator) == pool) {
  ------------------
  |  Branch (1975:12): [True: 0, False: 0]
  ------------------
 1976|      0|        apr_allocator_destroy(pool->allocator);
 1977|      0|    }
 1978|       |
 1979|       |    /* Free the pool itself */
 1980|    822|    free(pool);
 1981|    822|}
apr_pools.c:pool_lock:
 1474|    411|{
 1475|    411|#if APR_HAS_THREADS
 1476|    411|    apr_thread_mutex_lock(pool->mutex);
 1477|    411|#endif /* APR_HAS_THREADS */
 1478|    411|}
apr_pools.c:pool_unlock:
 1482|    411|{
 1483|    411|#if APR_HAS_THREADS
 1484|    411|    apr_thread_mutex_unlock(pool->mutex);
 1485|    411|#endif /* APR_HAS_THREADS */
 1486|    411|}

apr_inet_pton:
   80|    153|{
   81|    153|	switch (af) {
   82|      0|	case AF_INET:
  ------------------
  |  Branch (82:2): [True: 0, False: 153]
  ------------------
   83|      0|		return (inet_pton4(src, dst));
   84|      0|#if APR_HAVE_IPV6
   85|    153|	case AF_INET6:
  ------------------
  |  Branch (85:2): [True: 153, False: 0]
  ------------------
   86|    153|		return (inet_pton6(src, dst));
   87|      0|#endif
   88|      0|	default:
  ------------------
  |  Branch (88:2): [True: 0, False: 153]
  ------------------
   89|      0|		errno = EAFNOSUPPORT;
   90|      0|		return (-1);
   91|    153|	}
   92|       |	/* NOTREACHED */
   93|    153|}
inet_pton.c:inet_pton4:
  107|     59|{
  108|     59|    static const char digits[] = "0123456789";
  109|     59|    int saw_digit, octets, ch;
  110|     59|    unsigned char tmp[INADDRSZ], *tp;
  111|       |
  112|     59|    saw_digit = 0;
  113|     59|    octets = 0;
  114|     59|    *(tp = tmp) = 0;
  115|    754|    while ((ch = *src++) != '\0') {
  ------------------
  |  Branch (115:12): [True: 719, False: 35]
  ------------------
  116|    719|	const char *pch;
  117|       |
  118|    719|	if ((pch = strchr(digits, ch)) != NULL) {
  ------------------
  |  Branch (118:6): [True: 642, False: 77]
  ------------------
  119|    642|	    unsigned int new = *tp * 10 + (unsigned int)(pch - digits);
  120|       |
  121|    642|	    if (new > 255)
  ------------------
  |  Branch (121:10): [True: 4, False: 638]
  ------------------
  122|      4|		return (0);
  123|    638|	    *tp = new;
  124|    638|	    if (! saw_digit) {
  ------------------
  |  Branch (124:10): [True: 75, False: 563]
  ------------------
  125|     75|		if (++octets > 4)
  ------------------
  |  Branch (125:7): [True: 0, False: 75]
  ------------------
  126|      0|		    return (0);
  127|     75|		saw_digit = 1;
  128|     75|	    }
  129|    638|	} else if (ch == '.' && saw_digit) {
  ------------------
  |  Branch (129:13): [True: 59, False: 18]
  |  Branch (129:26): [True: 58, False: 1]
  ------------------
  130|     58|	    if (octets == 4)
  ------------------
  |  Branch (130:10): [True: 1, False: 57]
  ------------------
  131|      1|		return (0);
  132|     57|	    *++tp = 0;
  133|     57|	    saw_digit = 0;
  134|     57|	} else
  135|     19|		return (0);
  136|    719|    }
  137|     35|    if (octets < 4)
  ------------------
  |  Branch (137:9): [True: 34, False: 1]
  ------------------
  138|     34|	return (0);
  139|       |
  140|      1|    memcpy(dst, tmp, INADDRSZ);
  ------------------
  |  |   46|      1|#define INADDRSZ    4
  ------------------
  141|      1|    return (1);
  142|     35|}
inet_pton.c:inet_pton6:
  160|    153|{
  161|    153|	static const char xdigits_l[] = "0123456789abcdef",
  162|    153|			  xdigits_u[] = "0123456789ABCDEF";
  163|    153|	unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
  164|    153|	const char *xdigits, *curtok;
  165|    153|	int ch, saw_xdigit;
  166|    153|	unsigned int val;
  167|       |
  168|    153|	memset((tp = tmp), '\0', IN6ADDRSZ);
  ------------------
  |  |   38|    153|#define IN6ADDRSZ   16
  ------------------
  169|    153|	endp = tp + IN6ADDRSZ;
  ------------------
  |  |   38|    153|#define IN6ADDRSZ   16
  ------------------
  170|    153|	colonp = NULL;
  171|       |	/* Leading :: requires some special handling. */
  172|    153|	if (*src == ':')
  ------------------
  |  Branch (172:6): [True: 18, False: 135]
  ------------------
  173|     18|		if (*++src != ':')
  ------------------
  |  Branch (173:7): [True: 11, False: 7]
  ------------------
  174|     11|			return (0);
  175|    142|	curtok = src;
  176|    142|	saw_xdigit = 0;
  177|    142|	val = 0;
  178|  1.07k|	while ((ch = *src++) != '\0') {
  ------------------
  |  Branch (178:9): [True: 1.01k, False: 53]
  ------------------
  179|  1.01k|		const char *pch;
  180|       |
  181|  1.01k|		if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
  ------------------
  |  Branch (181:7): [True: 293, False: 726]
  ------------------
  182|    293|			pch = strchr((xdigits = xdigits_u), ch);
  183|  1.01k|		if (pch != NULL) {
  ------------------
  |  Branch (183:7): [True: 856, False: 163]
  ------------------
  184|    856|			val <<= 4;
  185|    856|			val |= (pch - xdigits);
  186|    856|			if (val > 0xffff)
  ------------------
  |  Branch (186:8): [True: 5, False: 851]
  ------------------
  187|      5|				return (0);
  188|    851|			saw_xdigit = 1;
  189|    851|			continue;
  190|    856|		}
  191|    163|		if (ch == ':') {
  ------------------
  |  Branch (191:7): [True: 82, False: 81]
  ------------------
  192|     82|			curtok = src;
  193|     82|			if (!saw_xdigit) {
  ------------------
  |  Branch (193:8): [True: 11, False: 71]
  ------------------
  194|     11|				if (colonp)
  ------------------
  |  Branch (194:9): [True: 2, False: 9]
  ------------------
  195|      2|					return (0);
  196|      9|				colonp = tp;
  197|      9|				continue;
  198|     11|			}
  199|     71|			if (tp + INT16SZ > endp)
  ------------------
  |  |   42|     71|#define INT16SZ sizeof(apr_int16_t)
  ------------------
  |  Branch (199:8): [True: 1, False: 70]
  ------------------
  200|      1|				return (0);
  201|     70|			*tp++ = (unsigned char) (val >> 8) & 0xff;
  202|     70|			*tp++ = (unsigned char) val & 0xff;
  203|     70|			saw_xdigit = 0;
  204|     70|			val = 0;
  205|     70|			continue;
  206|     71|		}
  207|     81|		if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
  ------------------
  |  |   46|     60|#define INADDRSZ    4
  ------------------
  |  Branch (207:7): [True: 60, False: 21]
  |  Branch (207:20): [True: 59, False: 1]
  ------------------
  208|     81|		    inet_pton4(curtok, tp) > 0) {
  ------------------
  |  Branch (208:7): [True: 1, False: 58]
  ------------------
  209|      1|			tp += INADDRSZ;
  ------------------
  |  |   46|      1|#define INADDRSZ    4
  ------------------
  210|      1|			saw_xdigit = 0;
  211|      1|			break;	/* '\0' was seen by inet_pton4(). */
  212|      1|		}
  213|     80|		return (0);
  214|     81|	}
  215|     54|	if (saw_xdigit) {
  ------------------
  |  Branch (215:6): [True: 45, False: 9]
  ------------------
  216|     45|		if (tp + INT16SZ > endp)
  ------------------
  |  |   42|     45|#define INT16SZ sizeof(apr_int16_t)
  ------------------
  |  Branch (216:7): [True: 1, False: 44]
  ------------------
  217|      1|			return (0);
  218|     44|		*tp++ = (unsigned char) (val >> 8) & 0xff;
  219|     44|		*tp++ = (unsigned char) val & 0xff;
  220|     44|	}
  221|     53|	if (colonp != NULL) {
  ------------------
  |  Branch (221:6): [True: 7, False: 46]
  ------------------
  222|       |		/*
  223|       |		 * Since some memmove()'s erroneously fail to handle
  224|       |		 * overlapping regions, we'll do the shift by hand.
  225|       |		 */
  226|      7|		const apr_ssize_t n = tp - colonp;
  227|      7|		apr_ssize_t i;
  228|       |
  229|     45|		for (i = 1; i <= n; i++) {
  ------------------
  |  Branch (229:15): [True: 38, False: 7]
  ------------------
  230|     38|			endp[- i] = colonp[n - i];
  231|     38|			colonp[n - i] = 0;
  232|     38|		}
  233|      7|		tp = endp;
  234|      7|	}
  235|     53|	if (tp != endp)
  ------------------
  |  Branch (235:6): [True: 44, False: 9]
  ------------------
  236|     44|		return (0);
  237|      9|	memcpy(dst, tmp, IN6ADDRSZ);
  ------------------
  |  |   38|      9|#define IN6ADDRSZ   16
  ------------------
  238|      9|	return (1);
  239|     53|}

apr_parse_addr_port:
  245|    411|{
  246|    411|    const char *ch, *lastchar;
  247|    411|    int big_port;
  248|    411|    apr_size_t addrlen;
  249|       |
  250|    411|    *addr = NULL;         /* assume not specified */
  251|    411|    *scope_id = NULL;     /* assume not specified */
  252|    411|    *port = 0;            /* assume not specified */
  253|       |
  254|       |    /* First handle the optional port number.  That may be all that
  255|       |     * is specified in the string.
  256|       |     */
  257|    411|    ch = lastchar = str + strlen(str) - 1;
  258|  4.19M|    while (ch >= str && apr_isdigit(*ch)) {
  ------------------
  |  |  209|  4.19M|#define apr_isdigit(c) (isdigit(((unsigned char)(c))))
  |  |  ------------------
  |  |  |  Branch (209:24): [True: 4.19M, False: 310]
  |  |  ------------------
  ------------------
  |  Branch (258:12): [True: 4.19M, False: 101]
  ------------------
  259|  4.19M|        --ch;
  260|  4.19M|    }
  261|       |
  262|    411|    if (ch < str) {       /* Entire string is the port. */
  ------------------
  |  Branch (262:9): [True: 101, False: 310]
  ------------------
  263|    101|        big_port = atoi(str);
  264|    101|        if (big_port < 1 || big_port > 65535) {
  ------------------
  |  Branch (264:13): [True: 35, False: 66]
  |  Branch (264:29): [True: 30, False: 36]
  ------------------
  265|     65|            return APR_EINVAL;
  ------------------
  |  |  715|     65|#define APR_EINVAL EINVAL
  ------------------
  266|     65|        }
  267|     36|        *port = big_port;
  268|     36|        return APR_SUCCESS;
  ------------------
  |  |  225|     36|#define APR_SUCCESS 0
  ------------------
  269|    101|    }
  270|       |
  271|    310|    if (*ch == ':' && ch < lastchar) { /* host and port number specified */
  ------------------
  |  Branch (271:9): [True: 137, False: 173]
  |  Branch (271:23): [True: 136, False: 1]
  ------------------
  272|    136|        if (ch == str) {               /* string starts with ':' -- bad */
  ------------------
  |  Branch (272:13): [True: 40, False: 96]
  ------------------
  273|     40|            return APR_EINVAL;
  ------------------
  |  |  715|     40|#define APR_EINVAL EINVAL
  ------------------
  274|     40|        }
  275|     96|        big_port = atoi(ch + 1);
  276|     96|        if (big_port < 1 || big_port > 65535) {
  ------------------
  |  Branch (276:13): [True: 32, False: 64]
  |  Branch (276:29): [True: 29, False: 35]
  ------------------
  277|     61|            return APR_EINVAL;
  ------------------
  |  |  715|     61|#define APR_EINVAL EINVAL
  ------------------
  278|     61|        }
  279|     35|        *port = big_port;
  280|     35|        lastchar = ch - 1;
  281|     35|    }
  282|       |
  283|       |    /* now handle the hostname */
  284|    209|    addrlen = lastchar - str + 1;
  285|       |
  286|       |/* XXX we don't really have to require APR_HAVE_IPV6 for this;
  287|       | * just pass char[] for ipaddr (so we don't depend on struct in6_addr)
  288|       | * and always define APR_INET6
  289|       | */
  290|    209|#if APR_HAVE_IPV6
  291|    209|    if (*str == '[') {
  ------------------
  |  Branch (291:9): [True: 158, False: 51]
  ------------------
  292|    158|        const char *end_bracket = memchr(str, ']', addrlen);
  293|    158|        struct in6_addr ipaddr;
  294|    158|        const char *scope_delim;
  295|       |
  296|    158|        if (!end_bracket || end_bracket != lastchar) {
  ------------------
  |  Branch (296:13): [True: 3, False: 155]
  |  Branch (296:29): [True: 1, False: 154]
  ------------------
  297|      4|            *port = 0;
  298|      4|            return APR_EINVAL;
  ------------------
  |  |  715|      4|#define APR_EINVAL EINVAL
  ------------------
  299|      4|        }
  300|       |
  301|       |        /* handle scope id; this is the only context where it is allowed */
  302|    154|        scope_delim = memchr(str, '%', addrlen);
  303|    154|        if (scope_delim) {
  ------------------
  |  Branch (303:13): [True: 2, False: 152]
  ------------------
  304|      2|            if (scope_delim == end_bracket - 1) { /* '%' without scope id */
  ------------------
  |  Branch (304:17): [True: 1, False: 1]
  ------------------
  305|      1|                *port = 0;
  306|      1|                return APR_EINVAL;
  ------------------
  |  |  715|      1|#define APR_EINVAL EINVAL
  ------------------
  307|      1|            }
  308|      1|            addrlen = scope_delim - str - 1;
  309|      1|            *scope_id = apr_pstrmemdup(p, scope_delim + 1, end_bracket - scope_delim - 1);
  310|      1|        }
  311|    152|        else {
  312|    152|            addrlen = addrlen - 2; /* minus 2 for '[' and ']' */
  313|    152|        }
  314|       |
  315|    153|        *addr = apr_pstrmemdup(p, str + 1, addrlen);
  316|    153|        if (apr_inet_pton(AF_INET6, *addr, &ipaddr) != 1) {
  ------------------
  |  Branch (316:13): [True: 144, False: 9]
  ------------------
  317|    144|            *addr = NULL;
  318|    144|            *scope_id = NULL;
  319|    144|            *port = 0;
  320|    144|            return APR_EINVAL;
  ------------------
  |  |  715|    144|#define APR_EINVAL EINVAL
  ------------------
  321|    144|        }
  322|    153|    }
  323|     51|    else
  324|     51|#endif
  325|     51|    {
  326|       |        /* XXX If '%' is not a valid char in a DNS name, we *could* check
  327|       |         *     for bogus scope ids first.
  328|       |         */
  329|     51|        *addr = apr_pstrmemdup(p, str, addrlen);
  330|     51|    }
  331|     60|    return APR_SUCCESS;
  ------------------
  |  |  225|     60|#define APR_SUCCESS 0
  ------------------
  332|    209|}

apr_pstrmemdup:
  100|    205|{
  101|    205|    char *res;
  102|       |
  103|    205|    if (s == NULL) {
  ------------------
  |  Branch (103:9): [True: 0, False: 205]
  ------------------
  104|      0|        return NULL;
  105|      0|    }
  106|    205|    res = apr_palloc(a, n + 1);
  ------------------
  |  |  425|    205|    apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    205|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  153|    205|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  155|    205|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  107|    205|    memcpy(res, s, n);
  108|    205|    res[n] = '\0';
  109|    205|    return res;
  110|    205|}

apr_os_thread_current:
  340|    822|{
  341|    822|    return pthread_self();
  342|    822|}

