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

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

apr_thread_mutex_create:
   40|    418|{
   41|    418|    apr_thread_mutex_t *new_mutex;
   42|    418|    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|    418|    new_mutex = apr_pcalloc(pool, sizeof(apr_thread_mutex_t));
  ------------------
  |  |  454|    418|    apr_pcalloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    418|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    418|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    418|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   51|    418|    new_mutex->pool = pool;
   52|       |
   53|    418|#ifdef HAVE_PTHREAD_MUTEX_RECURSIVE
   54|    418|    if (flags & APR_THREAD_MUTEX_NESTED) {
  ------------------
  |  |   44|    418|#define APR_THREAD_MUTEX_NESTED   0x1   /**< enable nested (recursive) locks */
  ------------------
  |  Branch (54:9): [True: 418, False: 0]
  ------------------
   55|    418|        pthread_mutexattr_t mattr;
   56|       |
   57|    418|        rv = pthread_mutexattr_init(&mattr);
   58|    418|        if (rv) return rv;
  ------------------
  |  Branch (58:13): [True: 0, False: 418]
  ------------------
   59|       |
   60|    418|        rv = pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE);
   61|    418|        if (rv) {
  ------------------
  |  Branch (61:13): [True: 0, False: 418]
  ------------------
   62|      0|            pthread_mutexattr_destroy(&mattr);
   63|      0|            return rv;
   64|      0|        }
   65|       |
   66|    418|        rv = pthread_mutex_init(&new_mutex->mutex, &mattr);
   67|       |
   68|    418|        pthread_mutexattr_destroy(&mattr);
   69|    418|    } 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|    418|    if (rv) {
  ------------------
  |  Branch (92:9): [True: 0, False: 418]
  ------------------
   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|    418|    apr_pool_cleanup_register(new_mutex->pool,
  113|    418|                              new_mutex, thread_mutex_cleanup,
  114|    418|                              apr_pool_cleanup_null);
  115|       |
  116|    418|    *mutex = new_mutex;
  117|    418|    return APR_SUCCESS;
  ------------------
  |  |  225|    418|#define APR_SUCCESS 0
  ------------------
  118|    418|}
apr_thread_mutex_lock:
  121|    836|{
  122|    836|    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|    836|    rv = pthread_mutex_lock(&mutex->mutex);
  159|       |#ifdef HAVE_ZOS_PTHREADS
  160|       |    if (rv) {
  161|       |        rv = errno;
  162|       |    }
  163|       |#endif
  164|       |
  165|    836|    return rv;
  166|    836|}
apr_thread_mutex_unlock:
  302|    836|{
  303|    836|    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|    836|    status = pthread_mutex_unlock(&mutex->mutex);
  331|       |#ifdef HAVE_ZOS_PTHREADS
  332|       |    if (status) {
  333|       |        status = errno;
  334|       |    }
  335|       |#endif
  336|       |
  337|    836|    return status;
  338|    836|}
thread_mutex.c:thread_mutex_cleanup:
   24|    418|{
   25|    418|    apr_thread_mutex_t *mutex = data;
   26|    418|    apr_status_t rv;
   27|       |
   28|    418|    rv = pthread_mutex_destroy(&mutex->mutex);
   29|       |#ifdef HAVE_ZOS_PTHREADS
   30|       |    if (rv) {
   31|       |        rv = errno;
   32|       |    }
   33|       |#endif
   34|    418|    return rv;
   35|    418|}

apr_pool_initialize:
 1674|    418|{
 1675|    418|    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|    418|    if (apr_pools_initialized++)
  ------------------
  |  Branch (1681:9): [True: 0, False: 418]
  ------------------
 1682|      0|        return APR_SUCCESS;
  ------------------
  |  |  225|      0|#define APR_SUCCESS 0
  ------------------
 1683|       |
 1684|    418|#if defined(_SC_PAGESIZE)
 1685|    418|    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|    418|    boundary_index = 12;
 1694|    418|    while ( (1 << boundary_index) < boundary_size)
  ------------------
  |  Branch (1694:13): [True: 0, False: 418]
  ------------------
 1695|      0|        boundary_index++;
 1696|    418|    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|    418|    if ((rv = apr_pool_create_ex(&global_pool, NULL, NULL,
  ------------------
  |  |  247|    418|    apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
  |  |  248|    418|                             APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    418|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    418|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    418|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1703:9): [True: 0, False: 418]
  ------------------
 1704|    418|                                 NULL)) != APR_SUCCESS) {
  ------------------
  |  |  225|    418|#define APR_SUCCESS 0
  ------------------
 1705|      0|        return rv;
 1706|      0|    }
 1707|       |
 1708|    418|    apr_pool_tag(global_pool, "APR global pool");
 1709|       |
 1710|    418|    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|    418|    if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) {
  ------------------
  |  |  225|    418|#define APR_SUCCESS 0
  ------------------
  |  Branch (1715:9): [True: 0, False: 418]
  ------------------
 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|    418|    return APR_SUCCESS;
  ------------------
  |  |  225|    418|#define APR_SUCCESS 0
  ------------------
 1759|    418|}
apr_pool_terminate:
 1762|    418|{
 1763|    418|    if (!apr_pools_initialized)
  ------------------
  |  Branch (1763:9): [True: 0, False: 418]
  ------------------
 1764|      0|        return;
 1765|       |
 1766|    418|    if (--apr_pools_initialized)
  ------------------
  |  Branch (1766:9): [True: 0, False: 418]
  ------------------
 1767|      0|        return;
 1768|       |
 1769|    418|    apr_pool_destroy(global_pool); /* This will also destroy the mutex */
  ------------------
  |  |  388|    418|    apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    418|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    418|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    418|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1770|    418|    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|    418|}
apr_palloc_debug:
 1823|    627|{
 1824|    627|    void *mem;
 1825|       |
 1826|    627|    apr_pool_check_integrity(pool);
 1827|       |
 1828|    627|    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|    627|    return mem;
 1835|    627|}
apr_pcalloc_debug:
 1839|    418|{
 1840|    418|    void *mem;
 1841|       |
 1842|    418|    apr_pool_check_integrity(pool);
 1843|       |
 1844|    418|    mem = pool_alloc(pool, size);
 1845|    418|    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|    418|    return mem;
 1852|    418|}
apr_pool_destroy_debug:
 1985|    836|{
 1986|    836|#if APR_HAS_THREADS
 1987|    836|    apr_thread_mutex_t *mutex;
 1988|    836|#endif
 1989|       |
 1990|    836|    apr_pool_check_lifetime(pool);
 1991|       |
 1992|    836|    if (pool->joined) {
  ------------------
  |  Branch (1992:9): [True: 0, False: 836]
  ------------------
 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|    836|#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|    836|    mutex = parent_lock(pool);
 2008|    836|#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|    836|    pool_destroy_debug(pool, file_line);
 2015|       |
 2016|    836|#if APR_HAS_THREADS
 2017|       |    /* Unlock the mutex we obtained above */
 2018|    836|    parent_unlock(mutex);
 2019|    836|#endif /* APR_HAS_THREADS */
 2020|    836|}
apr_pool_create_ex_debug:
 2027|    836|{
 2028|    836|    apr_pool_t *pool;
 2029|       |
 2030|    836|    *newpool = NULL;
 2031|       |
 2032|    836|    if (!parent) {
  ------------------
  |  Branch (2032:9): [True: 836, False: 0]
  ------------------
 2033|    836|        parent = global_pool;
 2034|    836|    }
 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|    836|    if (!abort_fn && parent)
  ------------------
  |  Branch (2042:9): [True: 836, False: 0]
  |  Branch (2042:22): [True: 418, False: 418]
  ------------------
 2043|    418|        abort_fn = parent->abort_fn;
 2044|       |
 2045|    836|    if ((pool = malloc(SIZEOF_POOL_T)) == NULL) {
  ------------------
  |  |  618|    836|#define SIZEOF_POOL_T       APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
  |  |  ------------------
  |  |  |  |  150|    836|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    836|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2045:9): [True: 0, False: 836]
  ------------------
 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|    836|    memset(pool, 0, SIZEOF_POOL_T);
  ------------------
  |  |  618|    836|#define SIZEOF_POOL_T       APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
  |  |  ------------------
  |  |  |  |  150|    836|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    836|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2053|       |
 2054|    836|    pool->allocator = allocator;
 2055|    836|    pool->abort_fn = abort_fn;
 2056|    836|    pool->tag = file_line;
 2057|    836|    pool->file_line = file_line;
 2058|       |
 2059|    836|#if APR_HAS_THREADS
 2060|    836|    pool->owner = apr_os_thread_current();
 2061|    836|#endif /* APR_HAS_THREADS */
 2062|       |#ifdef NETWARE
 2063|       |    pool->owner_proc = (apr_os_proc_t)getnlmhandle();
 2064|       |#endif /* defined(NETWARE) */
 2065|       |
 2066|    836|#if APR_HAS_THREADS
 2067|    836|    if (parent == NULL || parent->allocator != allocator) {
  ------------------
  |  Branch (2067:9): [True: 418, False: 418]
  |  Branch (2067:27): [True: 0, False: 418]
  ------------------
 2068|    418|        apr_status_t rv;
 2069|       |
 2070|       |        /* No matter what the creation flags say, always create
 2071|       |         * a lock.  Without it integrity_check and apr_pool_num_bytes
 2072|       |         * blow up (because they traverse pools child lists that
 2073|       |         * possibly belong to another thread, in combination with
 2074|       |         * the pool having no lock).  However, this might actually
 2075|       |         * hide problems like creating a child pool of a pool
 2076|       |         * belonging to another thread.
 2077|       |         */
 2078|    418|        if ((rv = apr_thread_mutex_create(&pool->mutex,
  ------------------
  |  Branch (2078:13): [True: 0, False: 418]
  ------------------
 2079|    418|                APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) {
  ------------------
  |  |   44|    418|#define APR_THREAD_MUTEX_NESTED   0x1   /**< enable nested (recursive) locks */
  ------------------
                              APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) {
  ------------------
  |  |  225|    418|#define APR_SUCCESS 0
  ------------------
 2080|      0|            free(pool);
 2081|      0|            return rv;
 2082|      0|        }
 2083|    418|    }
 2084|    418|    else {
 2085|    418|        pool->mutex = parent->mutex;
 2086|    418|    }
 2087|    836|#endif /* APR_HAS_THREADS */
 2088|       |
 2089|    836|    if ((pool->parent = parent) != NULL) {
  ------------------
  |  Branch (2089:9): [True: 418, False: 418]
  ------------------
 2090|    418|        pool_lock(parent);
 2091|       |
 2092|    418|        if ((pool->sibling = parent->child) != NULL)
  ------------------
  |  Branch (2092:13): [True: 0, False: 418]
  ------------------
 2093|      0|            pool->sibling->ref = &pool->sibling;
 2094|       |
 2095|    418|        parent->child = pool;
 2096|    418|        pool->ref = &parent->child;
 2097|       |
 2098|    418|        pool_unlock(parent);
 2099|    418|    }
 2100|    418|    else {
 2101|    418|        pool->sibling = NULL;
 2102|    418|        pool->ref = NULL;
 2103|    418|    }
 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|    836|    *newpool = pool;
 2110|       |
 2111|    836|    return APR_SUCCESS;
  ------------------
  |  |  225|    836|#define APR_SUCCESS 0
  ------------------
 2112|    836|}
apr_pool_tag:
 2440|    418|{
 2441|    418|    pool->tag = tag;
 2442|    418|}
apr_pool_cleanup_register:
 2530|    418|{
 2531|    418|    cleanup_t *c = NULL;
 2532|       |
 2533|    418|#if APR_POOL_DEBUG
 2534|    418|    apr_pool_check_integrity(p);
 2535|    418|#endif /* APR_POOL_DEBUG */
 2536|       |
 2537|    418|    if (p != NULL) {
  ------------------
  |  Branch (2537:9): [True: 418, False: 0]
  ------------------
 2538|    418|        if (p->free_cleanups) {
  ------------------
  |  Branch (2538:13): [True: 0, False: 418]
  ------------------
 2539|       |            /* reuse a cleanup structure */
 2540|      0|            c = p->free_cleanups;
 2541|      0|            p->free_cleanups = c->next;
 2542|    418|        } else {
 2543|    418|            c = apr_palloc(p, sizeof(cleanup_t));
  ------------------
  |  |  425|    418|    apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    418|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    418|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    418|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2544|    418|        }
 2545|    418|        c->data = data;
 2546|    418|        c->plain_cleanup_fn = plain_cleanup_fn;
 2547|    418|        c->child_cleanup_fn = child_cleanup_fn;
 2548|    418|        c->next = p->cleanups;
 2549|    418|        p->cleanups = c;
 2550|    418|    }
 2551|       |
 2552|    418|#if APR_POOL_DEBUG
 2553|    418|    if (!c || !c->plain_cleanup_fn || !c->child_cleanup_fn) {
  ------------------
  |  Branch (2553:9): [True: 0, False: 418]
  |  Branch (2553:15): [True: 0, False: 418]
  |  Branch (2553:39): [True: 0, False: 418]
  ------------------
 2554|      0|        abort();
 2555|      0|    }
 2556|    418|#endif /* APR_POOL_DEBUG */
 2557|    418|}
apr_pool_destroy:
 2965|    418|{
 2966|    418|    apr_pool_destroy_debug(pool, "undefined");
 2967|    418|}
apr_pool_create_ex:
 2979|    418|{
 2980|    418|    return apr_pool_create_ex_debug(newpool, parent,
 2981|    418|                                    abort_fn, allocator,
 2982|    418|                                    "undefined");
 2983|    418|}
apr_pools.c:apr_pool_check_integrity:
 1657|  1.46k|{
 1658|  1.46k|    apr_pool_check_lifetime(pool);
 1659|  1.46k|    apr_pool_check_owner(pool);
 1660|  1.46k|}
apr_pools.c:apr_pool_check_owner:
 1642|  2.29k|{
 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.29k|}
apr_pools.c:pool_alloc:
 1783|  1.04k|{
 1784|  1.04k|    debug_node_t *node;
 1785|  1.04k|    void *mem;
 1786|       |
 1787|  1.04k|    if ((mem = malloc(size)) == NULL) {
  ------------------
  |  Branch (1787:9): [True: 0, False: 1.04k]
  ------------------
 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.04k|    node = pool->nodes;
 1795|  1.04k|    if (node == NULL || node->index == 64) {
  ------------------
  |  Branch (1795:9): [True: 626, False: 419]
  |  Branch (1795:25): [True: 0, False: 419]
  ------------------
 1796|    626|        if ((node = malloc(SIZEOF_DEBUG_NODE_T)) == NULL) {
  ------------------
  |  |  562|    626|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  150|    626|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    626|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1796:13): [True: 0, False: 626]
  ------------------
 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|    626|        memset(node, 0, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  |  562|    626|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  150|    626|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    626|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1805|       |
 1806|    626|        node->next = pool->nodes;
 1807|    626|        pool->nodes = node;
 1808|    626|        node->index = 0;
 1809|    626|    }
 1810|       |
 1811|  1.04k|    node->beginp[node->index] = mem;
 1812|  1.04k|    node->endp[node->index] = (char *)mem + size;
 1813|  1.04k|    node->index++;
 1814|       |
 1815|  1.04k|    pool->stat_alloc++;
 1816|  1.04k|    pool->stat_total_alloc++;
 1817|       |
 1818|  1.04k|    return mem;
 1819|  1.04k|}
apr_pools.c:apr_pool_check_lifetime:
 1616|  2.29k|{
 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.29k|    if (pool == global_pool || global_pool == NULL)
  ------------------
  |  Branch (1622:9): [True: 418, False: 1.88k]
  |  Branch (1622:32): [True: 1.25k, False: 627]
  ------------------
 1623|  1.67k|        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.29k|}
apr_pools.c:parent_lock:
 1491|    836|{
 1492|    836|    if (pool->parent) {
  ------------------
  |  Branch (1492:9): [True: 418, False: 418]
  ------------------
 1493|    418|        apr_thread_mutex_lock(pool->parent->mutex);
 1494|    418|        return pool->parent->mutex;
 1495|    418|    }
 1496|    418|    return NULL;
 1497|    836|}
apr_pools.c:pool_clear_debug:
 1862|    836|{
 1863|    836|    debug_node_t *node;
 1864|    836|    apr_size_t index;
 1865|       |
 1866|       |    /* Run pre destroy cleanups */
 1867|    836|    run_cleanups(&pool->pre_cleanups);
 1868|    836|    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|    836|    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|    836|    while (pool->child)
  ------------------
  |  Branch (1879:12): [True: 0, False: 836]
  ------------------
 1880|      0|        pool_destroy_debug(pool->child, file_line);
 1881|       |
 1882|       |    /* Run cleanups */
 1883|    836|    run_cleanups(&pool->cleanups);
 1884|    836|    pool->free_cleanups = NULL;
 1885|    836|    pool->cleanups = NULL;
 1886|       |
 1887|       |    /* If new child pools showed up, this is a reason to raise a flag */
 1888|    836|    if (pool->child)
  ------------------
  |  Branch (1888:9): [True: 0, False: 836]
  ------------------
 1889|      0|        abort();
 1890|       |
 1891|       |    /* Free subprocesses */
 1892|    836|    free_proc_chain(pool->subprocesses);
 1893|    836|    pool->subprocesses = NULL;
 1894|       |
 1895|       |    /* Clear the user data. */
 1896|    836|    pool->user_data = NULL;
 1897|       |
 1898|       |    /* Free the blocks, scribbling over them first to help highlight
 1899|       |     * use-after-free issues. */
 1900|  1.46k|    while ((node = pool->nodes) != NULL) {
  ------------------
  |  Branch (1900:12): [True: 626, False: 836]
  ------------------
 1901|    626|        pool->nodes = node->next;
 1902|       |
 1903|  1.67k|        for (index = 0; index < node->index; index++) {
  ------------------
  |  Branch (1903:25): [True: 1.04k, False: 626]
  ------------------
 1904|  1.04k|            memset(node->beginp[index], POOL_POISON_BYTE,
  ------------------
  |  | 1859|  1.04k|#define POOL_POISON_BYTE 'A'
  ------------------
 1905|  1.04k|                   (char *)node->endp[index] - (char *)node->beginp[index]);
 1906|  1.04k|            free(node->beginp[index]);
 1907|  1.04k|        }
 1908|       |
 1909|    626|        memset(node, POOL_POISON_BYTE, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  | 1859|    626|#define POOL_POISON_BYTE 'A'
  ------------------
                      memset(node, POOL_POISON_BYTE, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  |  562|    626|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  150|    626|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    626|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1910|    626|        free(node);
 1911|    626|    }
 1912|       |
 1913|    836|    pool->stat_alloc = 0;
 1914|    836|    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|    836|}
apr_pools.c:run_cleanups:
 2684|  1.67k|{
 2685|  1.67k|    cleanup_t *c = *cref;
 2686|       |
 2687|  2.09k|    while (c) {
  ------------------
  |  Branch (2687:12): [True: 418, False: 1.67k]
  ------------------
 2688|    418|        *cref = c->next;
 2689|    418|        (*c->plain_cleanup_fn)((void *)c->data);
 2690|    418|        c = *cref;
 2691|    418|    }
 2692|  1.67k|}
apr_pools.c:free_proc_chain:
 2764|    836|{
 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|    836|    struct process_chain *pc;
 2770|    836|    int need_timeout = 0;
 2771|    836|    apr_time_t timeout_interval;
 2772|       |
 2773|    836|    if (!procs)
  ------------------
  |  Branch (2773:9): [True: 836, False: 0]
  ------------------
 2774|    836|        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|    836|{
 1502|    836|    if (mutex) {
  ------------------
  |  Branch (1502:9): [True: 418, False: 418]
  ------------------
 1503|    418|        apr_thread_mutex_unlock(mutex);
 1504|    418|    }
 1505|    836|}
apr_pools.c:pool_destroy_debug:
 1964|    836|{
 1965|    836|    pool_clear_debug(pool, file_line);
 1966|       |
 1967|       |    /* Remove the pool from the parent's child list */
 1968|    836|    if (pool->parent != NULL
  ------------------
  |  Branch (1968:9): [True: 418, False: 418]
  ------------------
 1969|    836|        && (*pool->ref = pool->sibling) != NULL) {
  ------------------
  |  Branch (1969:12): [True: 0, False: 418]
  ------------------
 1970|      0|        pool->sibling->ref = pool->ref;
 1971|      0|    }
 1972|       |
 1973|       |    /* Destroy the allocator if the pool owns it */
 1974|    836|    if (pool->allocator != NULL
  ------------------
  |  Branch (1974:9): [True: 0, False: 836]
  ------------------
 1975|    836|        && 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|    836|    free(pool);
 1981|    836|}
apr_pools.c:pool_lock:
 1474|    418|{
 1475|    418|#if APR_HAS_THREADS
 1476|    418|    apr_thread_mutex_lock(pool->mutex);
 1477|    418|#endif /* APR_HAS_THREADS */
 1478|    418|}
apr_pools.c:pool_unlock:
 1482|    418|{
 1483|    418|#if APR_HAS_THREADS
 1484|    418|    apr_thread_mutex_unlock(pool->mutex);
 1485|    418|#endif /* APR_HAS_THREADS */
 1486|    418|}

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

apr_parse_addr_port:
  245|    418|{
  246|    418|    const char *ch, *lastchar;
  247|    418|    int big_port;
  248|    418|    apr_size_t addrlen;
  249|       |
  250|    418|    *addr = NULL;         /* assume not specified */
  251|    418|    *scope_id = NULL;     /* assume not specified */
  252|    418|    *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|    418|    ch = lastchar = str + strlen(str) - 1;
  258|  4.19M|    while (ch >= str && apr_isdigit(*ch)) {
  ------------------
  |  |  212|  4.19M|#define apr_isdigit(c) (isdigit(((unsigned char)(c))))
  |  |  ------------------
  |  |  |  Branch (212:24): [True: 4.19M, False: 316]
  |  |  ------------------
  ------------------
  |  Branch (258:12): [True: 4.19M, False: 102]
  ------------------
  259|  4.19M|        --ch;
  260|  4.19M|    }
  261|       |
  262|    418|    if (ch < str) {       /* Entire string is the port. */
  ------------------
  |  Branch (262:9): [True: 102, False: 316]
  ------------------
  263|    102|        big_port = atoi(str);
  264|    102|        if (big_port < 1 || big_port > 65535) {
  ------------------
  |  Branch (264:13): [True: 34, False: 68]
  |  Branch (264:29): [True: 31, False: 37]
  ------------------
  265|     65|            return APR_EINVAL;
  ------------------
  |  |  715|     65|#define APR_EINVAL EINVAL
  ------------------
  266|     65|        }
  267|     37|        *port = big_port;
  268|     37|        return APR_SUCCESS;
  ------------------
  |  |  225|     37|#define APR_SUCCESS 0
  ------------------
  269|    102|    }
  270|       |
  271|    316|    if (*ch == ':' && ch < lastchar) { /* host and port number specified */
  ------------------
  |  Branch (271:9): [True: 137, False: 179]
  |  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|    215|    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|    215|#if APR_HAVE_IPV6
  291|    215|    if (*str == '[') {
  ------------------
  |  Branch (291:9): [True: 166, False: 49]
  ------------------
  292|    166|        const char *end_bracket = memchr(str, ']', addrlen);
  293|    166|        struct in6_addr ipaddr;
  294|    166|        const char *scope_delim;
  295|       |
  296|    166|        if (!end_bracket || end_bracket != lastchar) {
  ------------------
  |  Branch (296:13): [True: 5, False: 161]
  |  Branch (296:29): [True: 1, False: 160]
  ------------------
  297|      6|            *port = 0;
  298|      6|            return APR_EINVAL;
  ------------------
  |  |  715|      6|#define APR_EINVAL EINVAL
  ------------------
  299|      6|        }
  300|       |
  301|       |        /* handle scope id; this is the only context where it is allowed */
  302|    160|        scope_delim = memchr(str, '%', addrlen);
  303|    160|        if (scope_delim) {
  ------------------
  |  Branch (303:13): [True: 2, False: 158]
  ------------------
  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|    158|        else {
  312|    158|            addrlen = addrlen - 2; /* minus 2 for '[' and ']' */
  313|    158|        }
  314|       |
  315|    159|        *addr = apr_pstrmemdup(p, str + 1, addrlen);
  316|    159|        if (apr_inet_pton(AF_INET6, *addr, &ipaddr) != 1) {
  ------------------
  |  Branch (316:13): [True: 149, False: 10]
  ------------------
  317|    149|            *addr = NULL;
  318|    149|            *scope_id = NULL;
  319|    149|            *port = 0;
  320|    149|            return APR_EINVAL;
  ------------------
  |  |  715|    149|#define APR_EINVAL EINVAL
  ------------------
  321|    149|        }
  322|    159|    }
  323|     49|    else
  324|     49|#endif
  325|     49|    {
  326|       |        /* XXX If '%' is not a valid char in a DNS name, we *could* check
  327|       |         *     for bogus scope ids first.
  328|       |         */
  329|     49|        *addr = apr_pstrmemdup(p, str, addrlen);
  330|     49|    }
  331|     59|    return APR_SUCCESS;
  ------------------
  |  |  225|     59|#define APR_SUCCESS 0
  ------------------
  332|    215|}

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

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

