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

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

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

apr_pool_initialize:
 1662|    466|{
 1663|    466|    apr_status_t rv;
 1664|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1665|       |    char *logpath;
 1666|       |    apr_file_t *debug_log = NULL;
 1667|       |#endif
 1668|       |
 1669|    466|    if (apr_pools_initialized++)
  ------------------
  |  Branch (1669:9): [True: 0, False: 466]
  ------------------
 1670|      0|        return APR_SUCCESS;
  ------------------
  |  |  225|      0|#define APR_SUCCESS 0
  ------------------
 1671|       |
 1672|    466|#if defined(_SC_PAGESIZE)
 1673|    466|    boundary_size = sysconf(_SC_PAGESIZE);
 1674|       |#elif defined(WIN32)
 1675|       |    {
 1676|       |        SYSTEM_INFO si;
 1677|       |        GetSystemInfo(&si);
 1678|       |        boundary_size = si.dwPageSize;
 1679|       |    }
 1680|       |#endif
 1681|    466|    boundary_index = 12;
 1682|    466|    while ( (1 << boundary_index) < boundary_size)
  ------------------
  |  Branch (1682:13): [True: 0, False: 466]
  ------------------
 1683|      0|        boundary_index++;
 1684|    466|    boundary_size = (1 << boundary_index);
 1685|       |
 1686|       |    /* Since the debug code works a bit differently then the
 1687|       |     * regular pools code, we ask for a lock here.  The regular
 1688|       |     * pools code has got this lock embedded in the global
 1689|       |     * allocator, a concept unknown to debug mode.
 1690|       |     */
 1691|    466|    if ((rv = apr_pool_create_ex(&global_pool, NULL, NULL,
  ------------------
  |  |  247|    466|    apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
  |  |  248|    466|                             APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    466|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    466|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    466|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1691:9): [True: 0, False: 466]
  ------------------
 1692|    466|                                 NULL)) != APR_SUCCESS) {
  ------------------
  |  |  225|    466|#define APR_SUCCESS 0
  ------------------
 1693|      0|        return rv;
 1694|      0|    }
 1695|       |
 1696|    466|    apr_pool_tag(global_pool, "APR global pool");
 1697|       |
 1698|    466|    apr_pools_initialized = 1;
 1699|       |
 1700|       |    /* This has to happen here because mutexes might be backed by
 1701|       |     * atomics.  It used to be snug and safe in apr_initialize().
 1702|       |     */
 1703|    466|    if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) {
  ------------------
  |  |  225|    466|#define APR_SUCCESS 0
  ------------------
  |  Branch (1703:9): [True: 0, False: 466]
  ------------------
 1704|      0|        return rv;
 1705|      0|    }
 1706|       |
 1707|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1708|       |    rv = apr_env_get(&logpath, "APR_POOL_DEBUG_LOG", global_pool);
 1709|       |
 1710|       |    /* Don't pass file_stderr directly to apr_file_open() here, since
 1711|       |     * apr_file_open() can call back to apr_pool_log_event() and that
 1712|       |     * may attempt to use then then non-NULL but partially set up file
 1713|       |     * object. */
 1714|       |    if (rv == APR_SUCCESS) {
 1715|       |        apr_file_open(&debug_log, logpath,
 1716|       |                      APR_FOPEN_APPEND|APR_FOPEN_WRITE|APR_FOPEN_CREATE,
 1717|       |                      APR_FPROT_OS_DEFAULT, global_pool);
 1718|       |    }
 1719|       |    else {
 1720|       |        apr_file_open_stderr(&debug_log, global_pool);
 1721|       |    }
 1722|       |
 1723|       |    /* debug_log is now a file handle. */
 1724|       |    file_stderr = debug_log;
 1725|       |
 1726|       |    if (file_stderr) {
 1727|       |        apr_file_printf(file_stderr,
 1728|       |            "POOL DEBUG: [PID"
 1729|       |#if APR_HAS_THREADS
 1730|       |            "/TID"
 1731|       |#endif /* APR_HAS_THREADS */
 1732|       |            "] ACTION  (SIZE      /POOL SIZE /TOTAL SIZE) "
 1733|       |            "POOL       \"TAG\" <__FILE__:__LINE__> PARENT     (ALLOCS/TOTAL ALLOCS/CLEARS)\n");
 1734|       |
 1735|       |        apr_pool_log_event(global_pool, "GLOBAL", __FILE__ ":apr_pool_initialize", 0);
 1736|       |
 1737|       |        /* Add a cleanup handler that sets the debug log file handle
 1738|       |         * to NULL, otherwise we'll try to log the global pool
 1739|       |         * destruction event with predictably disastrous results. */
 1740|       |        apr_pool_cleanup_register(global_pool, NULL,
 1741|       |                                  apr_pool_cleanup_file_stderr,
 1742|       |                                  apr_pool_cleanup_null);
 1743|       |    }
 1744|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1745|       |
 1746|    466|    return APR_SUCCESS;
  ------------------
  |  |  225|    466|#define APR_SUCCESS 0
  ------------------
 1747|    466|}
apr_pool_terminate:
 1750|    466|{
 1751|    466|    if (!apr_pools_initialized)
  ------------------
  |  Branch (1751:9): [True: 0, False: 466]
  ------------------
 1752|      0|        return;
 1753|       |
 1754|    466|    if (--apr_pools_initialized)
  ------------------
  |  Branch (1754:9): [True: 0, False: 466]
  ------------------
 1755|      0|        return;
 1756|       |
 1757|    466|    apr_pool_destroy(global_pool); /* This will also destroy the mutex */
  ------------------
  |  |  388|    466|    apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    466|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    466|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    466|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1758|    466|    global_pool = NULL;
 1759|       |
 1760|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1761|       |    file_stderr = NULL;
 1762|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1763|    466|}
apr_palloc_debug:
 1811|    698|{
 1812|    698|    void *mem;
 1813|       |
 1814|    698|    apr_pool_check_integrity(pool);
 1815|       |
 1816|    698|    mem = pool_alloc(pool, size);
 1817|       |
 1818|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC)
 1819|       |    apr_pool_log_event(pool, "PALLOC", file_line, 1);
 1820|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC) */
 1821|       |
 1822|    698|    return mem;
 1823|    698|}
apr_pcalloc_debug:
 1827|    466|{
 1828|    466|    void *mem;
 1829|       |
 1830|    466|    apr_pool_check_integrity(pool);
 1831|       |
 1832|    466|    mem = pool_alloc(pool, size);
 1833|    466|    memset(mem, 0, size);
 1834|       |
 1835|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC)
 1836|       |    apr_pool_log_event(pool, "PCALLOC", file_line, 1);
 1837|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALLOC) */
 1838|       |
 1839|    466|    return mem;
 1840|    466|}
apr_pool_destroy_debug:
 1973|    932|{
 1974|    932|#if APR_HAS_THREADS
 1975|    932|    apr_thread_mutex_t *mutex;
 1976|    932|#endif
 1977|       |
 1978|    932|    apr_pool_check_lifetime(pool);
 1979|       |
 1980|    932|    if (pool->joined) {
  ------------------
  |  Branch (1980:9): [True: 0, False: 932]
  ------------------
 1981|       |        /* Joined pools must not be explicitly destroyed; the caller
 1982|       |         * has broken the guarantee. */
 1983|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1984|       |        apr_pool_log_event(pool, "LIFE",
 1985|       |                           __FILE__ ":apr_pool_destroy abort on joined", 0);
 1986|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1987|       |
 1988|      0|        abort();
 1989|      0|    }
 1990|       |
 1991|    932|#if APR_HAS_THREADS
 1992|       |    /* Lock the parent mutex before destroying so that it's not accessed
 1993|       |     * concurrently by apr_pool_walk_tree.
 1994|       |     */
 1995|    932|    mutex = parent_lock(pool);
 1996|    932|#endif
 1997|       |
 1998|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
 1999|       |    apr_pool_log_event(pool, "DESTROY", file_line, 1);
 2000|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
 2001|       |
 2002|    932|    pool_destroy_debug(pool, file_line);
 2003|       |
 2004|    932|#if APR_HAS_THREADS
 2005|       |    /* Unlock the mutex we obtained above */
 2006|    932|    parent_unlock(mutex);
 2007|    932|#endif /* APR_HAS_THREADS */
 2008|    932|}
apr_pool_create_ex_debug:
 2015|    932|{
 2016|    932|    apr_pool_t *pool;
 2017|       |
 2018|    932|    *newpool = NULL;
 2019|       |
 2020|    932|    if (!parent) {
  ------------------
  |  Branch (2020:9): [True: 932, False: 0]
  ------------------
 2021|    932|        parent = global_pool;
 2022|    932|    }
 2023|      0|    else {
 2024|      0|       apr_pool_check_lifetime(parent);
 2025|       |
 2026|      0|       if (!allocator)
  ------------------
  |  Branch (2026:12): [True: 0, False: 0]
  ------------------
 2027|      0|           allocator = parent->allocator;
 2028|      0|    }
 2029|       |
 2030|    932|    if (!abort_fn && parent)
  ------------------
  |  Branch (2030:9): [True: 932, False: 0]
  |  Branch (2030:22): [True: 466, False: 466]
  ------------------
 2031|    466|        abort_fn = parent->abort_fn;
 2032|       |
 2033|    932|    if ((pool = malloc(SIZEOF_POOL_T)) == NULL) {
  ------------------
  |  |  615|    932|#define SIZEOF_POOL_T       APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
  |  |  ------------------
  |  |  |  |  150|    932|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    932|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2033:9): [True: 0, False: 932]
  ------------------
 2034|      0|        if (abort_fn)
  ------------------
  |  Branch (2034:13): [True: 0, False: 0]
  ------------------
 2035|      0|            abort_fn(APR_ENOMEM);
  ------------------
  |  |  687|      0|#define APR_ENOMEM ENOMEM
  ------------------
 2036|       |
 2037|      0|         return APR_ENOMEM;
  ------------------
  |  |  687|      0|#define APR_ENOMEM ENOMEM
  ------------------
 2038|      0|    }
 2039|       |
 2040|    932|    memset(pool, 0, SIZEOF_POOL_T);
  ------------------
  |  |  615|    932|#define SIZEOF_POOL_T       APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
  |  |  ------------------
  |  |  |  |  150|    932|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    932|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2041|       |
 2042|    932|    pool->allocator = allocator;
 2043|    932|    pool->abort_fn = abort_fn;
 2044|    932|    pool->tag = file_line;
 2045|    932|    pool->file_line = file_line;
 2046|       |
 2047|    932|#if APR_HAS_THREADS
 2048|    932|    pool->owner = apr_os_thread_current();
 2049|    932|#endif /* APR_HAS_THREADS */
 2050|       |
 2051|    932|#if APR_HAS_THREADS
 2052|    932|    if (parent == NULL || parent->allocator != allocator) {
  ------------------
  |  Branch (2052:9): [True: 466, False: 466]
  |  Branch (2052:27): [True: 0, False: 466]
  ------------------
 2053|    466|        apr_status_t rv;
 2054|       |
 2055|       |        /* No matter what the creation flags say, always create
 2056|       |         * a lock.  Without it integrity_check and apr_pool_num_bytes
 2057|       |         * blow up (because they traverse pools child lists that
 2058|       |         * possibly belong to another thread, in combination with
 2059|       |         * the pool having no lock).  However, this might actually
 2060|       |         * hide problems like creating a child pool of a pool
 2061|       |         * belonging to another thread.
 2062|       |         */
 2063|    466|        if ((rv = apr_thread_mutex_create(&pool->mutex,
  ------------------
  |  Branch (2063:13): [True: 0, False: 466]
  ------------------
 2064|    466|                APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) {
  ------------------
  |  |   44|    466|#define APR_THREAD_MUTEX_NESTED   0x1   /**< enable nested (recursive) locks */
  ------------------
                              APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) {
  ------------------
  |  |  225|    466|#define APR_SUCCESS 0
  ------------------
 2065|      0|            if (abort_fn)
  ------------------
  |  Branch (2065:17): [True: 0, False: 0]
  ------------------
 2066|      0|                abort_fn(rv);
 2067|      0|            free(pool);
 2068|      0|            return rv;
 2069|      0|        }
 2070|    466|    }
 2071|    466|    else {
 2072|    466|        pool->mutex = parent->mutex;
 2073|    466|    }
 2074|    932|#endif /* APR_HAS_THREADS */
 2075|       |
 2076|    932|    if ((pool->parent = parent) != NULL) {
  ------------------
  |  Branch (2076:9): [True: 466, False: 466]
  ------------------
 2077|    466|        pool_lock(parent);
 2078|       |
 2079|    466|        if ((pool->sibling = parent->child) != NULL)
  ------------------
  |  Branch (2079:13): [True: 0, False: 466]
  ------------------
 2080|      0|            pool->sibling->ref = &pool->sibling;
 2081|       |
 2082|    466|        parent->child = pool;
 2083|    466|        pool->ref = &parent->child;
 2084|       |
 2085|    466|        pool_unlock(parent);
 2086|    466|    }
 2087|    466|    else {
 2088|    466|        pool->sibling = NULL;
 2089|    466|        pool->ref = NULL;
 2090|    466|    }
 2091|       |
 2092|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
 2093|       |    apr_pool_log_event(pool, "CREATE", file_line, 1);
 2094|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
 2095|       |
 2096|    932|    *newpool = pool;
 2097|       |
 2098|    932|    return APR_SUCCESS;
  ------------------
  |  |  225|    932|#define APR_SUCCESS 0
  ------------------
 2099|    932|}
apr_pool_tag:
 2403|    466|{
 2404|    466|    pool->tag = tag;
 2405|    466|}
apr_pool_cleanup_register:
 2493|    466|{
 2494|    466|    cleanup_t *c = NULL;
 2495|       |
 2496|    466|#if APR_POOL_DEBUG
 2497|    466|    apr_pool_check_integrity(p);
 2498|    466|#endif /* APR_POOL_DEBUG */
 2499|       |
 2500|    466|    if (p != NULL) {
  ------------------
  |  Branch (2500:9): [True: 466, False: 0]
  ------------------
 2501|    466|        if (p->free_cleanups) {
  ------------------
  |  Branch (2501:13): [True: 0, False: 466]
  ------------------
 2502|       |            /* reuse a cleanup structure */
 2503|      0|            c = p->free_cleanups;
 2504|      0|            p->free_cleanups = c->next;
 2505|    466|        } else {
 2506|    466|            c = apr_palloc(p, sizeof(cleanup_t));
  ------------------
  |  |  425|    466|    apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    466|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    466|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    466|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2507|    466|        }
 2508|    466|        c->data = data;
 2509|    466|        c->plain_cleanup_fn = plain_cleanup_fn;
 2510|    466|        c->child_cleanup_fn = child_cleanup_fn;
 2511|    466|        c->next = p->cleanups;
 2512|    466|        p->cleanups = c;
 2513|    466|    }
 2514|       |
 2515|    466|#if APR_POOL_DEBUG
 2516|    466|    if (!c || !c->plain_cleanup_fn || !c->child_cleanup_fn) {
  ------------------
  |  Branch (2516:9): [True: 0, False: 466]
  |  Branch (2516:15): [True: 0, False: 466]
  |  Branch (2516:39): [True: 0, False: 466]
  ------------------
 2517|      0|        abort();
 2518|      0|    }
 2519|    466|#endif /* APR_POOL_DEBUG */
 2520|    466|}
apr_pool_destroy:
 2928|    466|{
 2929|    466|    apr_pool_destroy_debug(pool, "undefined");
 2930|    466|}
apr_pool_create_ex:
 2942|    466|{
 2943|    466|    return apr_pool_create_ex_debug(newpool, parent,
 2944|    466|                                    abort_fn, allocator,
 2945|    466|                                    "undefined");
 2946|    466|}
apr_pools.c:apr_pool_check_integrity:
 1645|  1.63k|{
 1646|  1.63k|    apr_pool_check_lifetime(pool);
 1647|  1.63k|    apr_pool_check_owner(pool);
 1648|  1.63k|}
apr_pools.c:apr_pool_check_owner:
 1630|  2.56k|{
 1631|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_OWNER)
 1632|       |#if APR_HAS_THREADS
 1633|       |    if (!apr_os_thread_equal(pool->owner, apr_os_thread_current())) {
 1634|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1635|       |        apr_pool_log_event(pool, "THREAD",
 1636|       |                           __FILE__ ":apr_pool_integrity check [owner]", 0);
 1637|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1638|       |        abort();
 1639|       |    }
 1640|       |#endif /* APR_HAS_THREADS */
 1641|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_OWNER) */
 1642|  2.56k|}
apr_pools.c:pool_alloc:
 1771|  1.16k|{
 1772|  1.16k|    debug_node_t *node;
 1773|  1.16k|    void *mem;
 1774|       |
 1775|  1.16k|    if ((mem = malloc(size)) == NULL) {
  ------------------
  |  Branch (1775:9): [True: 0, False: 1.16k]
  ------------------
 1776|      0|        if (pool->abort_fn)
  ------------------
  |  Branch (1776:13): [True: 0, False: 0]
  ------------------
 1777|      0|            pool->abort_fn(APR_ENOMEM);
  ------------------
  |  |  687|      0|#define APR_ENOMEM ENOMEM
  ------------------
 1778|       |
 1779|      0|        return NULL;
 1780|      0|    }
 1781|       |
 1782|  1.16k|    node = pool->nodes;
 1783|  1.16k|    if (node == NULL || node->index == 64) {
  ------------------
  |  Branch (1783:9): [True: 697, False: 467]
  |  Branch (1783:25): [True: 0, False: 467]
  ------------------
 1784|    697|        if ((node = malloc(SIZEOF_DEBUG_NODE_T)) == NULL) {
  ------------------
  |  |  562|    697|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  150|    697|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    697|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1784:13): [True: 0, False: 697]
  ------------------
 1785|      0|            free(mem);
 1786|      0|            if (pool->abort_fn)
  ------------------
  |  Branch (1786:17): [True: 0, False: 0]
  ------------------
 1787|      0|                pool->abort_fn(APR_ENOMEM);
  ------------------
  |  |  687|      0|#define APR_ENOMEM ENOMEM
  ------------------
 1788|       |
 1789|      0|            return NULL;
 1790|      0|        }
 1791|       |
 1792|    697|        memset(node, 0, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  |  562|    697|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  150|    697|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    697|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1793|       |
 1794|    697|        node->next = pool->nodes;
 1795|    697|        pool->nodes = node;
 1796|    697|        node->index = 0;
 1797|    697|    }
 1798|       |
 1799|  1.16k|    node->beginp[node->index] = mem;
 1800|  1.16k|    node->endp[node->index] = (char *)mem + size;
 1801|  1.16k|    node->index++;
 1802|       |
 1803|  1.16k|    pool->stat_alloc++;
 1804|  1.16k|    pool->stat_total_alloc++;
 1805|       |
 1806|  1.16k|    return mem;
 1807|  1.16k|}
apr_pools.c:apr_pool_check_lifetime:
 1598|  2.56k|{
 1599|       |    /* Rule of thumb: use of the global pool is always
 1600|       |     * ok, since the only user is apr_pools.c.  Unless
 1601|       |     * people have searched for the top level parent and
 1602|       |     * started to use that...
 1603|       |     * Like the global pool, unmanaged pools have their
 1604|       |     * own lifetime and no ->parent, ignore both here.
 1605|       |     * Last (internal) case is from apr_pool_create_ex_debug()
 1606|       |     * where pool->mutex is created before attaching to the
 1607|       |     * parent, hence an allocation happens with no ->parent
 1608|       |     * nor lifetime to be checked here.
 1609|       |     */
 1610|  2.56k|    if (pool->parent == NULL)
  ------------------
  |  Branch (1610:9): [True: 1.86k, False: 698]
  ------------------
 1611|  1.86k|        return;
 1612|       |
 1613|       |    /* Lifetime
 1614|       |     * This basically checks to see if the pool being used is still
 1615|       |     * a relative to the global pool.  If not it was previously
 1616|       |     * destroyed, in which case we abort().
 1617|       |     */
 1618|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_LIFETIME)
 1619|       |    if (!apr_pool_is_child_of(pool, global_pool)) {
 1620|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL)
 1621|       |        apr_pool_log_event(pool, "LIFE",
 1622|       |                           __FILE__ ":apr_pool_integrity check [lifetime]", 0);
 1623|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE_ALL) */
 1624|       |        abort();
 1625|       |    }
 1626|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_LIFETIME) */
 1627|  2.56k|}
apr_pools.c:parent_lock:
 1473|    932|{
 1474|    932|    if (pool->parent) {
  ------------------
  |  Branch (1474:9): [True: 466, False: 466]
  ------------------
 1475|    466|        apr_thread_mutex_lock(pool->parent->mutex);
 1476|    466|        return pool->parent->mutex;
 1477|    466|    }
 1478|    466|    return NULL;
 1479|    932|}
apr_pools.c:pool_clear_debug:
 1850|    932|{
 1851|    932|    debug_node_t *node;
 1852|    932|    apr_size_t index;
 1853|       |
 1854|       |    /* Run pre destroy cleanups */
 1855|    932|    run_cleanups(&pool->pre_cleanups);
 1856|    932|    pool->pre_cleanups = NULL;
 1857|       |
 1858|       |    /*
 1859|       |     * Now that we have given the pre cleanups the chance to kill of any
 1860|       |     * threads using the pool, the owner must be correct.
 1861|       |     */
 1862|    932|    apr_pool_check_owner(pool);
 1863|       |
 1864|       |    /* Destroy the subpools.  The subpools will detach themselves from
 1865|       |     * this pool thus this loop is safe and easy.
 1866|       |     */
 1867|    932|    while (pool->child)
  ------------------
  |  Branch (1867:12): [True: 0, False: 932]
  ------------------
 1868|      0|        pool_destroy_debug(pool->child, file_line);
 1869|       |
 1870|       |    /* Run cleanups */
 1871|    932|    run_cleanups(&pool->cleanups);
 1872|    932|    pool->free_cleanups = NULL;
 1873|    932|    pool->cleanups = NULL;
 1874|       |
 1875|       |    /* If new child pools showed up, this is a reason to raise a flag */
 1876|    932|    if (pool->child)
  ------------------
  |  Branch (1876:9): [True: 0, False: 932]
  ------------------
 1877|      0|        abort();
 1878|       |
 1879|       |    /* Free subprocesses */
 1880|    932|    free_proc_chain(pool->subprocesses);
 1881|    932|    pool->subprocesses = NULL;
 1882|       |
 1883|       |    /* Clear the user data. */
 1884|    932|    pool->user_data = NULL;
 1885|       |
 1886|       |    /* Free the blocks, scribbling over them first to help highlight
 1887|       |     * use-after-free issues. */
 1888|  1.62k|    while ((node = pool->nodes) != NULL) {
  ------------------
  |  Branch (1888:12): [True: 697, False: 932]
  ------------------
 1889|    697|        pool->nodes = node->next;
 1890|       |
 1891|  1.86k|        for (index = 0; index < node->index; index++) {
  ------------------
  |  Branch (1891:25): [True: 1.16k, False: 697]
  ------------------
 1892|  1.16k|            memset(node->beginp[index], POOL_POISON_BYTE,
  ------------------
  |  | 1847|  1.16k|#define POOL_POISON_BYTE 'A'
  ------------------
 1893|  1.16k|                   (char *)node->endp[index] - (char *)node->beginp[index]);
 1894|  1.16k|            free(node->beginp[index]);
 1895|  1.16k|        }
 1896|       |
 1897|    697|        memset(node, POOL_POISON_BYTE, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  | 1847|    697|#define POOL_POISON_BYTE 'A'
  ------------------
                      memset(node, POOL_POISON_BYTE, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  |  562|    697|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  150|    697|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    697|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1898|    697|        free(node);
 1899|    697|    }
 1900|       |
 1901|    932|    pool->stat_alloc = 0;
 1902|    932|    pool->stat_clear++;
 1903|       |
 1904|       |#if (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE)
 1905|       |    apr_pool_log_event(pool, "CLEARED", file_line, 1);
 1906|       |#endif /* (APR_POOL_DEBUG & APR_POOL_DEBUG_VERBOSE) */
 1907|    932|}
apr_pools.c:run_cleanups:
 2647|  1.86k|{
 2648|  1.86k|    cleanup_t *c = *cref;
 2649|       |
 2650|  2.33k|    while (c) {
  ------------------
  |  Branch (2650:12): [True: 466, False: 1.86k]
  ------------------
 2651|    466|        *cref = c->next;
 2652|    466|        (*c->plain_cleanup_fn)((void *)c->data);
 2653|    466|        c = *cref;
 2654|    466|    }
 2655|  1.86k|}
apr_pools.c:free_proc_chain:
 2727|    932|{
 2728|       |    /* Dispose of the subprocesses we've spawned off in the course of
 2729|       |     * whatever it was we're cleaning up now.  This may involve killing
 2730|       |     * some of them off...
 2731|       |     */
 2732|    932|    struct process_chain *pc;
 2733|    932|    int need_timeout = 0;
 2734|    932|    apr_time_t timeout_interval;
 2735|       |
 2736|    932|    if (!procs)
  ------------------
  |  Branch (2736:9): [True: 932, False: 0]
  ------------------
 2737|    932|        return; /* No work.  Whew! */
 2738|       |
 2739|       |    /* First, check to see if we need to do the SIGTERM, sleep, SIGKILL
 2740|       |     * dance with any of the processes we're cleaning up.  If we've got
 2741|       |     * any kill-on-sight subprocesses, ditch them now as well, so they
 2742|       |     * don't waste any more cycles doing whatever it is that they shouldn't
 2743|       |     * be doing anymore.
 2744|       |     */
 2745|       |
 2746|      0|#ifndef NEED_WAITPID
 2747|       |    /* Pick up all defunct processes */
 2748|      0|    for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2748:22): [True: 0, False: 0]
  ------------------
 2749|      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 (2749:13): [True: 0, False: 0]
  ------------------
 2750|      0|            pc->kill_how = APR_KILL_NEVER;
 2751|      0|    }
 2752|      0|#endif /* !defined(NEED_WAITPID) */
 2753|       |
 2754|      0|    for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2754:22): [True: 0, False: 0]
  ------------------
 2755|      0|#ifndef WIN32
 2756|      0|        if ((pc->kill_how == APR_KILL_AFTER_TIMEOUT)
  ------------------
  |  Branch (2756:13): [True: 0, False: 0]
  ------------------
 2757|      0|            || (pc->kill_how == APR_KILL_ONLY_ONCE)) {
  ------------------
  |  Branch (2757:16): [True: 0, False: 0]
  ------------------
 2758|       |            /*
 2759|       |             * Subprocess may be dead already.  Only need the timeout if not.
 2760|       |             * Note: apr_proc_kill on Windows is TerminateProcess(), which is
 2761|       |             * similar to a SIGKILL, so always give the process a timeout
 2762|       |             * under Windows before killing it.
 2763|       |             */
 2764|      0|            if (apr_proc_kill(pc->proc, SIGTERM) == APR_SUCCESS)
  ------------------
  |  |  225|      0|#define APR_SUCCESS 0
  ------------------
  |  Branch (2764:17): [True: 0, False: 0]
  ------------------
 2765|      0|                need_timeout = 1;
 2766|      0|        }
 2767|      0|        else if (pc->kill_how == APR_KILL_ALWAYS) {
  ------------------
  |  Branch (2767:18): [True: 0, False: 0]
  ------------------
 2768|       |#else /* WIN32 knows only one fast, clean method of killing processes today */
 2769|       |        if (pc->kill_how != APR_KILL_NEVER) {
 2770|       |            need_timeout = 1;
 2771|       |            pc->kill_how = APR_KILL_ALWAYS;
 2772|       |#endif
 2773|      0|            apr_proc_kill(pc->proc, SIGKILL);
 2774|      0|        }
 2775|      0|    }
 2776|       |
 2777|       |    /* Sleep only if we have to. The sleep algorithm grows
 2778|       |     * by a factor of two on each iteration. TIMEOUT_INTERVAL
 2779|       |     * is equal to TIMEOUT_USECS / 64.
 2780|       |     */
 2781|      0|    if (need_timeout) {
  ------------------
  |  Branch (2781:9): [True: 0, False: 0]
  ------------------
 2782|      0|        timeout_interval = TIMEOUT_INTERVAL;
  ------------------
  |  |  106|      0|#define TIMEOUT_INTERVAL   46875
  ------------------
 2783|      0|        apr_sleep(timeout_interval);
 2784|       |
 2785|      0|        do {
 2786|       |            /* check the status of the subprocesses */
 2787|      0|            need_timeout = 0;
 2788|      0|            for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2788:30): [True: 0, False: 0]
  ------------------
 2789|      0|                if (pc->kill_how == APR_KILL_AFTER_TIMEOUT) {
  ------------------
  |  Branch (2789:21): [True: 0, False: 0]
  ------------------
 2790|      0|                    if (apr_proc_wait(pc->proc, NULL, NULL, APR_NOWAIT)
  ------------------
  |  Branch (2790:25): [True: 0, False: 0]
  ------------------
 2791|      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
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2792|      0|                        need_timeout = 1;		/* subprocess is still active */
 2793|      0|                    else
 2794|      0|                        pc->kill_how = APR_KILL_NEVER;	/* subprocess has exited */
 2795|      0|                }
 2796|      0|            }
 2797|      0|            if (need_timeout) {
  ------------------
  |  Branch (2797:17): [True: 0, False: 0]
  ------------------
 2798|      0|                if (timeout_interval >= TIMEOUT_USECS) {
  ------------------
  |  |  105|      0|#define TIMEOUT_USECS    3000000
  ------------------
  |  Branch (2798:21): [True: 0, False: 0]
  ------------------
 2799|      0|                    break;
 2800|      0|                }
 2801|      0|                apr_sleep(timeout_interval);
 2802|      0|                timeout_interval *= 2;
 2803|      0|            }
 2804|      0|        } while (need_timeout);
  ------------------
  |  Branch (2804:18): [True: 0, False: 0]
  ------------------
 2805|      0|    }
 2806|       |
 2807|       |    /* OK, the scripts we just timed out for have had a chance to clean up
 2808|       |     * --- now, just get rid of them, and also clean up the system accounting
 2809|       |     * goop...
 2810|       |     */
 2811|      0|    for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2811:22): [True: 0, False: 0]
  ------------------
 2812|      0|        if (pc->kill_how == APR_KILL_AFTER_TIMEOUT)
  ------------------
  |  Branch (2812:13): [True: 0, False: 0]
  ------------------
 2813|      0|            apr_proc_kill(pc->proc, SIGKILL);
 2814|      0|    }
 2815|       |
 2816|       |    /* Now wait for all the signaled processes to die */
 2817|      0|    for (pc = procs; pc; pc = pc->next) {
  ------------------
  |  Branch (2817:22): [True: 0, False: 0]
  ------------------
 2818|      0|        if (pc->kill_how != APR_KILL_NEVER)
  ------------------
  |  Branch (2818:13): [True: 0, False: 0]
  ------------------
 2819|      0|            (void)apr_proc_wait(pc->proc, NULL, NULL, APR_WAIT);
 2820|      0|    }
 2821|      0|}
apr_pools.c:parent_unlock:
 1483|    932|{
 1484|    932|    if (mutex) {
  ------------------
  |  Branch (1484:9): [True: 466, False: 466]
  ------------------
 1485|    466|        apr_thread_mutex_unlock(mutex);
 1486|    466|    }
 1487|    932|}
apr_pools.c:pool_destroy_debug:
 1952|    932|{
 1953|    932|    pool_clear_debug(pool, file_line);
 1954|       |
 1955|       |    /* Remove the pool from the parent's child list */
 1956|    932|    if (pool->parent != NULL
  ------------------
  |  Branch (1956:9): [True: 466, False: 466]
  ------------------
 1957|    466|        && (*pool->ref = pool->sibling) != NULL) {
  ------------------
  |  Branch (1957:12): [True: 0, False: 466]
  ------------------
 1958|      0|        pool->sibling->ref = pool->ref;
 1959|      0|    }
 1960|       |
 1961|       |    /* Destroy the allocator if the pool owns it */
 1962|    932|    if (pool->allocator != NULL
  ------------------
  |  Branch (1962:9): [True: 0, False: 932]
  ------------------
 1963|      0|        && apr_allocator_owner_get(pool->allocator) == pool) {
  ------------------
  |  Branch (1963:12): [True: 0, False: 0]
  ------------------
 1964|      0|        apr_allocator_destroy(pool->allocator);
 1965|      0|    }
 1966|       |
 1967|       |    /* Free the pool itself */
 1968|    932|    free(pool);
 1969|    932|}
apr_pools.c:pool_lock:
 1456|    466|{
 1457|    466|#if APR_HAS_THREADS
 1458|    466|    apr_thread_mutex_lock(pool->mutex);
 1459|    466|#endif /* APR_HAS_THREADS */
 1460|    466|}
apr_pools.c:pool_unlock:
 1464|    466|{
 1465|    466|#if APR_HAS_THREADS
 1466|    466|    apr_thread_mutex_unlock(pool->mutex);
 1467|    466|#endif /* APR_HAS_THREADS */
 1468|    466|}

apr_inet_pton:
   80|    165|{
   81|    165|	switch (af) {
   82|      0|	case AF_INET:
  ------------------
  |  Branch (82:2): [True: 0, False: 165]
  ------------------
   83|      0|		return (inet_pton4(src, dst));
   84|      0|#if APR_HAVE_IPV6
   85|    165|	case AF_INET6:
  ------------------
  |  Branch (85:2): [True: 165, False: 0]
  ------------------
   86|    165|		return (inet_pton6(src, dst));
   87|      0|#endif
   88|      0|	default:
  ------------------
  |  Branch (88:2): [True: 0, False: 165]
  ------------------
   89|      0|		errno = EAFNOSUPPORT;
   90|      0|		return (-1);
   91|    165|	}
   92|       |	/* NOTREACHED */
   93|    165|}
inet_pton.c:inet_pton4:
  107|     64|{
  108|     64|    static const char digits[] = "0123456789";
  109|     64|    int saw_digit, octets, ch;
  110|     64|    unsigned char tmp[INADDRSZ], *tp;
  111|       |
  112|     64|    saw_digit = 0;
  113|     64|    octets = 0;
  114|     64|    *(tp = tmp) = 0;
  115|    757|    while ((ch = *src++) != '\0') {
  ------------------
  |  Branch (115:12): [True: 722, False: 35]
  ------------------
  116|    722|	const char *pch;
  117|       |
  118|    722|	if ((pch = strchr(digits, ch)) != NULL) {
  ------------------
  |  Branch (118:6): [True: 636, False: 86]
  ------------------
  119|    636|	    unsigned int new = *tp * 10 + (unsigned int)(pch - digits);
  120|       |
  121|    636|	    if (new > 255)
  ------------------
  |  Branch (121:10): [True: 4, False: 632]
  ------------------
  122|      4|		return (0);
  123|    632|	    *tp = new;
  124|    632|	    if (! saw_digit) {
  ------------------
  |  Branch (124:10): [True: 76, False: 556]
  ------------------
  125|     76|		if (++octets > 4)
  ------------------
  |  Branch (125:7): [True: 0, False: 76]
  ------------------
  126|      0|		    return (0);
  127|     76|		saw_digit = 1;
  128|     76|	    }
  129|    632|	} else if (ch == '.' && saw_digit) {
  ------------------
  |  Branch (129:13): [True: 69, False: 17]
  |  Branch (129:26): [True: 62, False: 7]
  ------------------
  130|     62|	    if (octets == 4)
  ------------------
  |  Branch (130:10): [True: 1, False: 61]
  ------------------
  131|      1|		return (0);
  132|     61|	    *++tp = 0;
  133|     61|	    saw_digit = 0;
  134|     61|	} else
  135|     24|		return (0);
  136|    722|    }
  137|     35|    if (octets < 4)
  ------------------
  |  Branch (137:9): [True: 32, False: 3]
  ------------------
  138|     32|	return (0);
  139|       |
  140|      3|    memcpy(dst, tmp, INADDRSZ);
  ------------------
  |  |   46|      3|#define INADDRSZ    4
  ------------------
  141|      3|    return (1);
  142|     35|}
inet_pton.c:inet_pton6:
  160|    165|{
  161|    165|	static const char xdigits_l[] = "0123456789abcdef",
  162|    165|			  xdigits_u[] = "0123456789ABCDEF";
  163|    165|	unsigned char tmp[IN6ADDRSZ], *tp, *endp, *colonp;
  164|    165|	const char *xdigits, *curtok;
  165|    165|	int ch, saw_xdigit;
  166|    165|	unsigned int val;
  167|       |
  168|    165|	memset((tp = tmp), '\0', IN6ADDRSZ);
  ------------------
  |  |   38|    165|#define IN6ADDRSZ   16
  ------------------
  169|    165|	endp = tp + IN6ADDRSZ;
  ------------------
  |  |   38|    165|#define IN6ADDRSZ   16
  ------------------
  170|    165|	colonp = NULL;
  171|       |	/* Leading :: requires some special handling. */
  172|    165|	if (*src == ':')
  ------------------
  |  Branch (172:6): [True: 17, False: 148]
  ------------------
  173|     17|		if (*++src != ':')
  ------------------
  |  Branch (173:7): [True: 10, False: 7]
  ------------------
  174|     10|			return (0);
  175|    155|	curtok = src;
  176|    155|	saw_xdigit = 0;
  177|    155|	val = 0;
  178|  1.20k|	while ((ch = *src++) != '\0') {
  ------------------
  |  Branch (178:9): [True: 1.14k, False: 63]
  ------------------
  179|  1.14k|		const char *pch;
  180|       |
  181|  1.14k|		if ((pch = strchr((xdigits = xdigits_l), ch)) == NULL)
  ------------------
  |  Branch (181:7): [True: 396, False: 748]
  ------------------
  182|    396|			pch = strchr((xdigits = xdigits_u), ch);
  183|  1.14k|		if (pch != NULL) {
  ------------------
  |  Branch (183:7): [True: 925, False: 219]
  ------------------
  184|    925|			val <<= 4;
  185|    925|			val |= (pch - xdigits);
  186|    925|			if (val > 0xffff)
  ------------------
  |  Branch (186:8): [True: 5, False: 920]
  ------------------
  187|      5|				return (0);
  188|    920|			saw_xdigit = 1;
  189|    920|			continue;
  190|    925|		}
  191|    219|		if (ch == ':') {
  ------------------
  |  Branch (191:7): [True: 134, False: 85]
  ------------------
  192|    134|			curtok = src;
  193|    134|			if (!saw_xdigit) {
  ------------------
  |  Branch (193:8): [True: 11, False: 123]
  ------------------
  194|     11|				if (colonp)
  ------------------
  |  Branch (194:9): [True: 1, False: 10]
  ------------------
  195|      1|					return (0);
  196|     10|				colonp = tp;
  197|     10|				continue;
  198|     11|			}
  199|    123|			if (tp + INT16SZ > endp)
  ------------------
  |  |   42|    123|#define INT16SZ sizeof(apr_int16_t)
  ------------------
  |  Branch (199:8): [True: 1, False: 122]
  ------------------
  200|      1|				return (0);
  201|    122|			*tp++ = (unsigned char) (val >> 8) & 0xff;
  202|    122|			*tp++ = (unsigned char) val & 0xff;
  203|    122|			saw_xdigit = 0;
  204|    122|			val = 0;
  205|    122|			continue;
  206|    123|		}
  207|     85|		if (ch == '.' && ((tp + INADDRSZ) <= endp) &&
  ------------------
  |  |   46|     65|#define INADDRSZ    4
  ------------------
  |  Branch (207:7): [True: 65, False: 20]
  |  Branch (207:20): [True: 64, False: 1]
  ------------------
  208|     64|		    inet_pton4(curtok, tp) > 0) {
  ------------------
  |  Branch (208:7): [True: 3, False: 61]
  ------------------
  209|      3|			tp += INADDRSZ;
  ------------------
  |  |   46|      3|#define INADDRSZ    4
  ------------------
  210|      3|			saw_xdigit = 0;
  211|      3|			break;	/* '\0' was seen by inet_pton4(). */
  212|      3|		}
  213|     82|		return (0);
  214|     85|	}
  215|     66|	if (saw_xdigit) {
  ------------------
  |  Branch (215:6): [True: 53, False: 13]
  ------------------
  216|     53|		if (tp + INT16SZ > endp)
  ------------------
  |  |   42|     53|#define INT16SZ sizeof(apr_int16_t)
  ------------------
  |  Branch (216:7): [True: 1, False: 52]
  ------------------
  217|      1|			return (0);
  218|     52|		*tp++ = (unsigned char) (val >> 8) & 0xff;
  219|     52|		*tp++ = (unsigned char) val & 0xff;
  220|     52|	}
  221|     65|	if (colonp != NULL) {
  ------------------
  |  Branch (221:6): [True: 7, False: 58]
  ------------------
  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|     65|	if (tp != endp)
  ------------------
  |  Branch (235:6): [True: 56, False: 9]
  ------------------
  236|     56|		return (0);
  237|      9|	memcpy(dst, tmp, IN6ADDRSZ);
  ------------------
  |  |   38|      9|#define IN6ADDRSZ   16
  ------------------
  238|      9|	return (1);
  239|     65|}

apr_parse_addr_port:
  245|    466|{
  246|    466|    const char *ch, *lastchar;
  247|    466|    int big_port;
  248|    466|    apr_size_t addrlen;
  249|       |
  250|    466|    *addr = NULL;         /* assume not specified */
  251|    466|    *scope_id = NULL;     /* assume not specified */
  252|    466|    *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|    466|    ch = lastchar = str + strlen(str) - 1;
  258|  7.86M|    while (ch >= str && apr_isdigit(*ch)) {
  ------------------
  |  |  212|  7.86M|#define apr_isdigit(c) (isdigit(((unsigned char)(c))))
  |  |  ------------------
  |  |  |  Branch (212:24): [True: 7.86M, False: 364]
  |  |  ------------------
  ------------------
  |  Branch (258:12): [True: 7.86M, False: 102]
  ------------------
  259|  7.86M|        --ch;
  260|  7.86M|    }
  261|       |
  262|    466|    if (ch < str) {       /* Entire string is the port. */
  ------------------
  |  Branch (262:9): [True: 102, False: 364]
  ------------------
  263|    102|        big_port = atoi(str);
  264|    102|        if (big_port < 1 || big_port > 65535) {
  ------------------
  |  Branch (264:13): [True: 35, False: 67]
  |  Branch (264:29): [True: 32, False: 35]
  ------------------
  265|     67|            return APR_EINVAL;
  ------------------
  |  |  715|     67|#define APR_EINVAL EINVAL
  ------------------
  266|     67|        }
  267|     35|        *port = big_port;
  268|     35|        return APR_SUCCESS;
  ------------------
  |  |  225|     35|#define APR_SUCCESS 0
  ------------------
  269|    102|    }
  270|       |
  271|    364|    if (*ch == ':' && ch < lastchar) { /* host and port number specified */
  ------------------
  |  Branch (271:9): [True: 177, False: 187]
  |  Branch (271:23): [True: 176, False: 1]
  ------------------
  272|    176|        if (ch == str) {               /* string starts with ':' -- bad */
  ------------------
  |  Branch (272:13): [True: 40, False: 136]
  ------------------
  273|     40|            return APR_EINVAL;
  ------------------
  |  |  715|     40|#define APR_EINVAL EINVAL
  ------------------
  274|     40|        }
  275|    136|        big_port = atoi(ch + 1);
  276|    136|        if (big_port < 1 || big_port > 65535) {
  ------------------
  |  Branch (276:13): [True: 55, False: 81]
  |  Branch (276:29): [True: 31, False: 50]
  ------------------
  277|     86|            return APR_EINVAL;
  ------------------
  |  |  715|     86|#define APR_EINVAL EINVAL
  ------------------
  278|     86|        }
  279|     50|        *port = big_port;
  280|     50|        lastchar = ch - 1;
  281|     50|    }
  282|       |
  283|       |    /* now handle the hostname */
  284|    238|    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|    238|#if APR_HAVE_IPV6
  291|    238|    if (*str == '[') {
  ------------------
  |  Branch (291:9): [True: 172, False: 66]
  ------------------
  292|    172|        const char *end_bracket = memchr(str, ']', addrlen);
  293|    172|        struct in6_addr ipaddr;
  294|    172|        const char *scope_delim;
  295|       |
  296|    172|        if (!end_bracket || end_bracket != lastchar) {
  ------------------
  |  Branch (296:13): [True: 4, False: 168]
  |  Branch (296:29): [True: 2, False: 166]
  ------------------
  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|    166|        scope_delim = memchr(str, '%', addrlen);
  303|    166|        if (scope_delim) {
  ------------------
  |  Branch (303:13): [True: 2, False: 164]
  ------------------
  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|    164|        else {
  312|    164|            addrlen = addrlen - 2; /* minus 2 for '[' and ']' */
  313|    164|        }
  314|       |
  315|    165|        *addr = apr_pstrmemdup(p, str + 1, addrlen);
  316|    165|        if (apr_inet_pton(AF_INET6, *addr, &ipaddr) != 1) {
  ------------------
  |  Branch (316:13): [True: 156, False: 9]
  ------------------
  317|    156|            *addr = NULL;
  318|    156|            *scope_id = NULL;
  319|    156|            *port = 0;
  320|    156|            return APR_EINVAL;
  ------------------
  |  |  715|    156|#define APR_EINVAL EINVAL
  ------------------
  321|    156|        }
  322|    165|    }
  323|     66|    else
  324|     66|#endif
  325|     66|    {
  326|       |        /* XXX If '%' is not a valid char in a DNS name, we *could* check
  327|       |         *     for bogus scope ids first.
  328|       |         */
  329|     66|        *addr = apr_pstrmemdup(p, str, addrlen);
  330|     66|    }
  331|     75|    return APR_SUCCESS;
  ------------------
  |  |  225|     75|#define APR_SUCCESS 0
  ------------------
  332|    238|}

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

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

