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

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

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

apr_pool_initialize:
 1662|    298|{
 1663|    298|    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|    298|    if (apr_pools_initialized++)
  ------------------
  |  Branch (1669:9): [True: 0, False: 298]
  ------------------
 1670|      0|        return APR_SUCCESS;
  ------------------
  |  |  225|      0|#define APR_SUCCESS 0
  ------------------
 1671|       |
 1672|    298|#if defined(_SC_PAGESIZE)
 1673|    298|    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|    298|    boundary_index = 12;
 1682|    298|    while ( (1 << boundary_index) < boundary_size)
  ------------------
  |  Branch (1682:13): [True: 0, False: 298]
  ------------------
 1683|      0|        boundary_index++;
 1684|    298|    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|    298|    if ((rv = apr_pool_create_ex(&global_pool, NULL, NULL,
  ------------------
  |  |  247|    298|    apr_pool_create_ex_debug(newpool, parent, abort_fn, allocator, \
  |  |  248|    298|                             APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    298|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    298|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    298|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1691:9): [True: 0, False: 298]
  ------------------
 1692|    298|                                 NULL)) != APR_SUCCESS) {
  ------------------
  |  |  225|    298|#define APR_SUCCESS 0
  ------------------
 1693|      0|        return rv;
 1694|      0|    }
 1695|       |
 1696|    298|    apr_pool_tag(global_pool, "APR global pool");
 1697|       |
 1698|    298|    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|    298|    if ((rv = apr_atomic_init(global_pool)) != APR_SUCCESS) {
  ------------------
  |  |  225|    298|#define APR_SUCCESS 0
  ------------------
  |  Branch (1703:9): [True: 0, False: 298]
  ------------------
 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|    298|    return APR_SUCCESS;
  ------------------
  |  |  225|    298|#define APR_SUCCESS 0
  ------------------
 1747|    298|}
apr_pool_terminate:
 1750|    298|{
 1751|    298|    if (!apr_pools_initialized)
  ------------------
  |  Branch (1751:9): [True: 0, False: 298]
  ------------------
 1752|      0|        return;
 1753|       |
 1754|    298|    if (--apr_pools_initialized)
  ------------------
  |  Branch (1754:9): [True: 0, False: 298]
  ------------------
 1755|      0|        return;
 1756|       |
 1757|    298|    apr_pool_destroy(global_pool); /* This will also destroy the mutex */
  ------------------
  |  |  388|    298|    apr_pool_destroy_debug(p, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    298|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    298|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    298|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1758|    298|    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|    298|}
apr_palloc_debug:
 1811|  1.09M|{
 1812|  1.09M|    void *mem;
 1813|       |
 1814|  1.09M|    apr_pool_check_integrity(pool);
 1815|       |
 1816|  1.09M|    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|  1.09M|    return mem;
 1823|  1.09M|}
apr_pcalloc_debug:
 1827|    298|{
 1828|    298|    void *mem;
 1829|       |
 1830|    298|    apr_pool_check_integrity(pool);
 1831|       |
 1832|    298|    mem = pool_alloc(pool, size);
 1833|    298|    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|    298|    return mem;
 1840|    298|}
apr_pool_destroy_debug:
 1973|    596|{
 1974|    596|#if APR_HAS_THREADS
 1975|    596|    apr_thread_mutex_t *mutex;
 1976|    596|#endif
 1977|       |
 1978|    596|    apr_pool_check_lifetime(pool);
 1979|       |
 1980|    596|    if (pool->joined) {
  ------------------
  |  Branch (1980:9): [True: 0, False: 596]
  ------------------
 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|    596|#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|    596|    mutex = parent_lock(pool);
 1996|    596|#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|    596|    pool_destroy_debug(pool, file_line);
 2003|       |
 2004|    596|#if APR_HAS_THREADS
 2005|       |    /* Unlock the mutex we obtained above */
 2006|    596|    parent_unlock(mutex);
 2007|    596|#endif /* APR_HAS_THREADS */
 2008|    596|}
apr_pool_create_ex_debug:
 2015|    596|{
 2016|    596|    apr_pool_t *pool;
 2017|       |
 2018|    596|    *newpool = NULL;
 2019|       |
 2020|    596|    if (!parent) {
  ------------------
  |  Branch (2020:9): [True: 596, False: 0]
  ------------------
 2021|    596|        parent = global_pool;
 2022|    596|    }
 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|    596|    if (!abort_fn && parent)
  ------------------
  |  Branch (2030:9): [True: 596, False: 0]
  |  Branch (2030:22): [True: 298, False: 298]
  ------------------
 2031|    298|        abort_fn = parent->abort_fn;
 2032|       |
 2033|    596|    if ((pool = malloc(SIZEOF_POOL_T)) == NULL) {
  ------------------
  |  |  615|    596|#define SIZEOF_POOL_T       APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
  |  |  ------------------
  |  |  |  |  150|    596|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    596|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (2033:9): [True: 0, False: 596]
  ------------------
 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|    596|    memset(pool, 0, SIZEOF_POOL_T);
  ------------------
  |  |  615|    596|#define SIZEOF_POOL_T       APR_ALIGN_DEFAULT(sizeof(apr_pool_t))
  |  |  ------------------
  |  |  |  |  150|    596|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|    596|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2041|       |
 2042|    596|    pool->allocator = allocator;
 2043|    596|    pool->abort_fn = abort_fn;
 2044|    596|    pool->tag = file_line;
 2045|    596|    pool->file_line = file_line;
 2046|       |
 2047|    596|#if APR_HAS_THREADS
 2048|    596|    pool->owner = apr_os_thread_current();
 2049|    596|#endif /* APR_HAS_THREADS */
 2050|       |
 2051|    596|#if APR_HAS_THREADS
 2052|    596|    if (parent == NULL || parent->allocator != allocator) {
  ------------------
  |  Branch (2052:9): [True: 298, False: 298]
  |  Branch (2052:27): [True: 0, False: 298]
  ------------------
 2053|    298|        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|    298|        if ((rv = apr_thread_mutex_create(&pool->mutex,
  ------------------
  |  Branch (2063:13): [True: 0, False: 298]
  ------------------
 2064|    298|                APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) {
  ------------------
  |  |   44|    298|#define APR_THREAD_MUTEX_NESTED   0x1   /**< enable nested (recursive) locks */
  ------------------
                              APR_THREAD_MUTEX_NESTED, pool)) != APR_SUCCESS) {
  ------------------
  |  |  225|    298|#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|    298|    }
 2071|    298|    else {
 2072|    298|        pool->mutex = parent->mutex;
 2073|    298|    }
 2074|    596|#endif /* APR_HAS_THREADS */
 2075|       |
 2076|    596|    if ((pool->parent = parent) != NULL) {
  ------------------
  |  Branch (2076:9): [True: 298, False: 298]
  ------------------
 2077|    298|        pool_lock(parent);
 2078|       |
 2079|    298|        if ((pool->sibling = parent->child) != NULL)
  ------------------
  |  Branch (2079:13): [True: 0, False: 298]
  ------------------
 2080|      0|            pool->sibling->ref = &pool->sibling;
 2081|       |
 2082|    298|        parent->child = pool;
 2083|    298|        pool->ref = &parent->child;
 2084|       |
 2085|    298|        pool_unlock(parent);
 2086|    298|    }
 2087|    298|    else {
 2088|    298|        pool->sibling = NULL;
 2089|    298|        pool->ref = NULL;
 2090|    298|    }
 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|    596|    *newpool = pool;
 2097|       |
 2098|    596|    return APR_SUCCESS;
  ------------------
  |  |  225|    596|#define APR_SUCCESS 0
  ------------------
 2099|    596|}
apr_pool_tag:
 2403|    298|{
 2404|    298|    pool->tag = tag;
 2405|    298|}
apr_pool_cleanup_register:
 2493|    298|{
 2494|    298|    cleanup_t *c = NULL;
 2495|       |
 2496|    298|#if APR_POOL_DEBUG
 2497|    298|    apr_pool_check_integrity(p);
 2498|    298|#endif /* APR_POOL_DEBUG */
 2499|       |
 2500|    298|    if (p != NULL) {
  ------------------
  |  Branch (2500:9): [True: 298, False: 0]
  ------------------
 2501|    298|        if (p->free_cleanups) {
  ------------------
  |  Branch (2501:13): [True: 0, False: 298]
  ------------------
 2502|       |            /* reuse a cleanup structure */
 2503|      0|            c = p->free_cleanups;
 2504|      0|            p->free_cleanups = c->next;
 2505|    298|        } else {
 2506|    298|            c = apr_palloc(p, sizeof(cleanup_t));
  ------------------
  |  |  425|    298|    apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    298|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    298|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    298|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 2507|    298|        }
 2508|    298|        c->data = data;
 2509|    298|        c->plain_cleanup_fn = plain_cleanup_fn;
 2510|    298|        c->child_cleanup_fn = child_cleanup_fn;
 2511|    298|        c->next = p->cleanups;
 2512|    298|        p->cleanups = c;
 2513|    298|    }
 2514|       |
 2515|    298|#if APR_POOL_DEBUG
 2516|    298|    if (!c || !c->plain_cleanup_fn || !c->child_cleanup_fn) {
  ------------------
  |  Branch (2516:9): [True: 0, False: 298]
  |  Branch (2516:15): [True: 0, False: 298]
  |  Branch (2516:39): [True: 0, False: 298]
  ------------------
 2517|      0|        abort();
 2518|      0|    }
 2519|    298|#endif /* APR_POOL_DEBUG */
 2520|    298|}
apr_pool_destroy:
 2928|    298|{
 2929|    298|    apr_pool_destroy_debug(pool, "undefined");
 2930|    298|}
apr_pool_create_ex:
 2942|    298|{
 2943|    298|    return apr_pool_create_ex_debug(newpool, parent,
 2944|    298|                                    abort_fn, allocator,
 2945|    298|                                    "undefined");
 2946|    298|}
apr_pools.c:apr_pool_check_integrity:
 1645|  1.09M|{
 1646|  1.09M|    apr_pool_check_lifetime(pool);
 1647|  1.09M|    apr_pool_check_owner(pool);
 1648|  1.09M|}
apr_pools.c:apr_pool_check_owner:
 1630|  1.09M|{
 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|  1.09M|}
apr_pools.c:pool_alloc:
 1771|  1.09M|{
 1772|  1.09M|    debug_node_t *node;
 1773|  1.09M|    void *mem;
 1774|       |
 1775|  1.09M|    if ((mem = malloc(size)) == NULL) {
  ------------------
  |  Branch (1775:9): [True: 0, False: 1.09M]
  ------------------
 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.09M|    node = pool->nodes;
 1783|  1.09M|    if (node == NULL || node->index == 64) {
  ------------------
  |  Branch (1783:9): [True: 596, False: 1.09M]
  |  Branch (1783:25): [True: 17.0k, False: 1.07M]
  ------------------
 1784|  17.6k|        if ((node = malloc(SIZEOF_DEBUG_NODE_T)) == NULL) {
  ------------------
  |  |  562|  17.6k|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  150|  17.6k|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  17.6k|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (1784:13): [True: 0, False: 17.6k]
  ------------------
 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|  17.6k|        memset(node, 0, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  |  562|  17.6k|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  150|  17.6k|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  17.6k|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1793|       |
 1794|  17.6k|        node->next = pool->nodes;
 1795|  17.6k|        pool->nodes = node;
 1796|  17.6k|        node->index = 0;
 1797|  17.6k|    }
 1798|       |
 1799|  1.09M|    node->beginp[node->index] = mem;
 1800|  1.09M|    node->endp[node->index] = (char *)mem + size;
 1801|  1.09M|    node->index++;
 1802|       |
 1803|  1.09M|    pool->stat_alloc++;
 1804|  1.09M|    pool->stat_total_alloc++;
 1805|       |
 1806|  1.09M|    return mem;
 1807|  1.09M|}
apr_pools.c:apr_pool_check_lifetime:
 1598|  1.09M|{
 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|  1.09M|    if (pool->parent == NULL)
  ------------------
  |  Branch (1610:9): [True: 1.19k, False: 1.09M]
  ------------------
 1611|  1.19k|        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|  1.09M|}
apr_pools.c:parent_lock:
 1473|    596|{
 1474|    596|    if (pool->parent) {
  ------------------
  |  Branch (1474:9): [True: 298, False: 298]
  ------------------
 1475|    298|        apr_thread_mutex_lock(pool->parent->mutex);
 1476|    298|        return pool->parent->mutex;
 1477|    298|    }
 1478|    298|    return NULL;
 1479|    596|}
apr_pools.c:pool_clear_debug:
 1850|    596|{
 1851|    596|    debug_node_t *node;
 1852|    596|    apr_size_t index;
 1853|       |
 1854|       |    /* Run pre destroy cleanups */
 1855|    596|    run_cleanups(&pool->pre_cleanups);
 1856|    596|    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|    596|    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|    596|    while (pool->child)
  ------------------
  |  Branch (1867:12): [True: 0, False: 596]
  ------------------
 1868|      0|        pool_destroy_debug(pool->child, file_line);
 1869|       |
 1870|       |    /* Run cleanups */
 1871|    596|    run_cleanups(&pool->cleanups);
 1872|    596|    pool->free_cleanups = NULL;
 1873|    596|    pool->cleanups = NULL;
 1874|       |
 1875|       |    /* If new child pools showed up, this is a reason to raise a flag */
 1876|    596|    if (pool->child)
  ------------------
  |  Branch (1876:9): [True: 0, False: 596]
  ------------------
 1877|      0|        abort();
 1878|       |
 1879|       |    /* Free subprocesses */
 1880|    596|    free_proc_chain(pool->subprocesses);
 1881|    596|    pool->subprocesses = NULL;
 1882|       |
 1883|       |    /* Clear the user data. */
 1884|    596|    pool->user_data = NULL;
 1885|       |
 1886|       |    /* Free the blocks, scribbling over them first to help highlight
 1887|       |     * use-after-free issues. */
 1888|  18.2k|    while ((node = pool->nodes) != NULL) {
  ------------------
  |  Branch (1888:12): [True: 17.6k, False: 596]
  ------------------
 1889|  17.6k|        pool->nodes = node->next;
 1890|       |
 1891|  1.10M|        for (index = 0; index < node->index; index++) {
  ------------------
  |  Branch (1891:25): [True: 1.09M, False: 17.6k]
  ------------------
 1892|  1.09M|            memset(node->beginp[index], POOL_POISON_BYTE,
  ------------------
  |  | 1847|  1.09M|#define POOL_POISON_BYTE 'A'
  ------------------
 1893|  1.09M|                   (char *)node->endp[index] - (char *)node->beginp[index]);
 1894|  1.09M|            free(node->beginp[index]);
 1895|  1.09M|        }
 1896|       |
 1897|  17.6k|        memset(node, POOL_POISON_BYTE, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  | 1847|  17.6k|#define POOL_POISON_BYTE 'A'
  ------------------
                      memset(node, POOL_POISON_BYTE, SIZEOF_DEBUG_NODE_T);
  ------------------
  |  |  562|  17.6k|#define SIZEOF_DEBUG_NODE_T APR_ALIGN_DEFAULT(sizeof(debug_node_t))
  |  |  ------------------
  |  |  |  |  150|  17.6k|#define APR_ALIGN_DEFAULT(size) APR_ALIGN(size, 8)
  |  |  |  |  ------------------
  |  |  |  |  |  |  147|  17.6k|    (((size) + ((boundary) - 1)) & ~((boundary) - 1))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1898|  17.6k|        free(node);
 1899|  17.6k|    }
 1900|       |
 1901|    596|    pool->stat_alloc = 0;
 1902|    596|    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|    596|}
apr_pools.c:run_cleanups:
 2647|  1.19k|{
 2648|  1.19k|    cleanup_t *c = *cref;
 2649|       |
 2650|  1.49k|    while (c) {
  ------------------
  |  Branch (2650:12): [True: 298, False: 1.19k]
  ------------------
 2651|    298|        *cref = c->next;
 2652|    298|        (*c->plain_cleanup_fn)((void *)c->data);
 2653|    298|        c = *cref;
 2654|    298|    }
 2655|  1.19k|}
apr_pools.c:free_proc_chain:
 2727|    596|{
 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|    596|    struct process_chain *pc;
 2733|    596|    int need_timeout = 0;
 2734|    596|    apr_time_t timeout_interval;
 2735|       |
 2736|    596|    if (!procs)
  ------------------
  |  Branch (2736:9): [True: 596, False: 0]
  ------------------
 2737|    596|        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|    596|{
 1484|    596|    if (mutex) {
  ------------------
  |  Branch (1484:9): [True: 298, False: 298]
  ------------------
 1485|    298|        apr_thread_mutex_unlock(mutex);
 1486|    298|    }
 1487|    596|}
apr_pools.c:pool_destroy_debug:
 1952|    596|{
 1953|    596|    pool_clear_debug(pool, file_line);
 1954|       |
 1955|       |    /* Remove the pool from the parent's child list */
 1956|    596|    if (pool->parent != NULL
  ------------------
  |  Branch (1956:9): [True: 298, False: 298]
  ------------------
 1957|    298|        && (*pool->ref = pool->sibling) != NULL) {
  ------------------
  |  Branch (1957:12): [True: 0, False: 298]
  ------------------
 1958|      0|        pool->sibling->ref = pool->ref;
 1959|      0|    }
 1960|       |
 1961|       |    /* Destroy the allocator if the pool owns it */
 1962|    596|    if (pool->allocator != NULL
  ------------------
  |  Branch (1962:9): [True: 0, False: 596]
  ------------------
 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|    596|    free(pool);
 1969|    596|}
apr_pools.c:pool_lock:
 1456|    298|{
 1457|    298|#if APR_HAS_THREADS
 1458|    298|    apr_thread_mutex_lock(pool->mutex);
 1459|    298|#endif /* APR_HAS_THREADS */
 1460|    298|}
apr_pools.c:pool_unlock:
 1464|    298|{
 1465|    298|#if APR_HAS_THREADS
 1466|    298|    apr_thread_mutex_unlock(pool->mutex);
 1467|    298|#endif /* APR_HAS_THREADS */
 1468|    298|}

apr_cpystrn:
   47|  1.09M|{
   48|       |
   49|  1.09M|    char *d = dst, *end;
   50|       |
   51|  1.09M|    if (dst_size == 0) {
  ------------------
  |  Branch (51:9): [True: 0, False: 1.09M]
  ------------------
   52|      0|        return (dst);
   53|      0|    }
   54|       |
   55|  1.09M|    if (src) {
  ------------------
  |  Branch (55:9): [True: 1.09M, False: 0]
  ------------------
   56|  1.09M|        end = dst + dst_size - 1;
   57|       |
   58|  4.24M|        for (; d < end; ++d, ++src) {
  ------------------
  |  Branch (58:16): [True: 3.14M, False: 1.09M]
  ------------------
   59|  3.14M|            if (!(*d = *src)) {
  ------------------
  |  Branch (59:17): [True: 0, False: 3.14M]
  ------------------
   60|      0|                return (d);
   61|      0|            }
   62|  3.14M|        }
   63|  1.09M|    }
   64|       |
   65|  1.09M|    *d = '\0';	/* always null terminate */
   66|       |
   67|  1.09M|    return (d);
   68|  1.09M|}
apr_tokenize_to_argv:
   90|    298|{
   91|    298|    const char *cp;
   92|    298|    const char *ct;
   93|    298|    char *cleaned, *dirty;
   94|    298|    int escaped;
   95|    298|    int isquoted, numargs = 0, argnum;
   96|       |
   97|    298|#define SKIP_WHITESPACE(cp) \
   98|    298|    for ( ; *cp == ' ' || *cp == '\t'; ) { \
   99|    298|        cp++; \
  100|    298|    };
  101|       |
  102|    298|#define CHECK_QUOTATION(cp,isquoted) \
  103|    298|    isquoted = 0; \
  104|    298|    if (*cp == '"') { \
  105|    298|        isquoted = 1; \
  106|    298|        cp++; \
  107|    298|    } \
  108|    298|    else if (*cp == '\'') { \
  109|    298|        isquoted = 2; \
  110|    298|        cp++; \
  111|    298|    }
  112|       |
  113|       |/* DETERMINE_NEXTSTRING:
  114|       | * At exit, cp will point to one of the following:  NULL, SPACE, TAB or QUOTE.
  115|       | * NULL implies the argument string has been fully traversed.
  116|       | */
  117|    298|#define DETERMINE_NEXTSTRING(cp,isquoted) \
  118|    298|    for ( ; *cp != '\0'; cp++) { \
  119|    298|        if (   (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \
  120|    298|                                *(cp+1) == '"' || *(cp+1) == '\''))) { \
  121|    298|            cp++; \
  122|    298|            continue; \
  123|    298|        } \
  124|    298|        if (   (!isquoted && (*cp == ' ' || *cp == '\t')) \
  125|    298|            || (isquoted == 1 && *cp == '"') \
  126|    298|            || (isquoted == 2 && *cp == '\'')                 ) { \
  127|    298|            break; \
  128|    298|        } \
  129|    298|    }
  130|       |
  131|       |/* REMOVE_ESCAPE_CHARS:
  132|       | * Compresses the arg string to remove all of the '\' escape chars.
  133|       | * The final argv strings should not have any extra escape chars in it.
  134|       | */
  135|    298|#define REMOVE_ESCAPE_CHARS(cleaned, dirty, escaped) \
  136|    298|    escaped = 0; \
  137|    298|    while(*dirty) { \
  138|    298|        if (!escaped && *dirty == '\\') { \
  139|    298|            escaped = 1; \
  140|    298|        } \
  141|    298|        else { \
  142|    298|            escaped = 0; \
  143|    298|            *cleaned++ = *dirty; \
  144|    298|        } \
  145|    298|        ++dirty; \
  146|    298|    } \
  147|    298|    *cleaned = 0;        /* last line of macro... */
  148|       |
  149|    298|    cp = arg_str;
  150|    298|    SKIP_WHITESPACE(cp);
  ------------------
  |  |   98|    835|    for ( ; *cp == ' ' || *cp == '\t'; ) { \
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 321, False: 514]
  |  |  |  Branch (98:27): [True: 216, False: 298]
  |  |  ------------------
  |  |   99|    537|        cp++; \
  |  |  100|    537|    };
  ------------------
  151|    298|    ct = cp;
  152|       |
  153|       |    /* This is ugly and expensive, but if anyone wants to figure a
  154|       |     * way to support any number of args without counting and
  155|       |     * allocating, please go ahead and change the code.
  156|       |     *
  157|       |     * Must account for the trailing NULL arg.
  158|       |     */
  159|    298|    numargs = 1;
  160|  1.09M|    while (*ct != '\0') {
  ------------------
  |  Branch (160:12): [True: 1.09M, False: 298]
  ------------------
  161|  1.09M|        CHECK_QUOTATION(ct, isquoted);
  ------------------
  |  |  103|  1.09M|    isquoted = 0; \
  |  |  104|  1.09M|    if (*cp == '"') { \
  |  |  ------------------
  |  |  |  Branch (104:9): [True: 548, False: 1.09M]
  |  |  ------------------
  |  |  105|    548|        isquoted = 1; \
  |  |  106|    548|        cp++; \
  |  |  107|    548|    } \
  |  |  108|  1.09M|    else if (*cp == '\'') { \
  |  |  ------------------
  |  |  |  Branch (108:14): [True: 1.08M, False: 1.15k]
  |  |  ------------------
  |  |  109|  1.08M|        isquoted = 2; \
  |  |  110|  1.08M|        cp++; \
  |  |  111|  1.08M|    }
  ------------------
  162|  1.09M|        DETERMINE_NEXTSTRING(ct, isquoted);
  ------------------
  |  |  118|  4.23M|    for ( ; *cp != '\0'; cp++) { \
  |  |  ------------------
  |  |  |  Branch (118:13): [True: 4.23M, False: 240]
  |  |  ------------------
  |  |  119|  4.23M|        if (   (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \
  |  |  ------------------
  |  |  |  Branch (119:17): [True: 1.72k, False: 4.23M]
  |  |  |  Branch (119:33): [True: 201, False: 1.52k]
  |  |  |  Branch (119:51): [True: 199, False: 1.32k]
  |  |  ------------------
  |  |  120|  1.72k|                                *(cp+1) == '"' || *(cp+1) == '\''))) { \
  |  |  ------------------
  |  |  |  Branch (120:33): [True: 390, False: 937]
  |  |  |  Branch (120:51): [True: 224, False: 713]
  |  |  ------------------
  |  |  121|  1.01k|            cp++; \
  |  |  122|  1.01k|            continue; \
  |  |  123|  1.01k|        } \
  |  |  124|  4.23M|        if (   (!isquoted && (*cp == ' ' || *cp == '\t')) \
  |  |  ------------------
  |  |  |  Branch (124:17): [True: 3.14M, False: 1.09M]
  |  |  |  Branch (124:31): [True: 497, False: 3.14M]
  |  |  |  Branch (124:45): [True: 477, False: 3.14M]
  |  |  ------------------
  |  |  125|  4.23M|            || (isquoted == 1 && *cp == '"') \
  |  |  ------------------
  |  |  |  Branch (125:17): [True: 695, False: 4.23M]
  |  |  |  Branch (125:34): [True: 536, False: 159]
  |  |  ------------------
  |  |  126|  4.23M|            || (isquoted == 2 && *cp == '\'')                 ) { \
  |  |  ------------------
  |  |  |  Branch (126:17): [True: 1.08M, False: 3.14M]
  |  |  |  Branch (126:34): [True: 1.08M, False: 31]
  |  |  ------------------
  |  |  127|  1.09M|            break; \
  |  |  128|  1.09M|        } \
  |  |  129|  4.23M|    }
  ------------------
  163|  1.09M|        if (*ct != '\0') {
  ------------------
  |  Branch (163:13): [True: 1.09M, False: 240]
  ------------------
  164|  1.09M|            ct++;
  165|  1.09M|        }
  166|  1.09M|        numargs++;
  167|  1.09M|        SKIP_WHITESPACE(ct);
  ------------------
  |  |   98|  1.09M|    for ( ; *cp == ' ' || *cp == '\t'; ) { \
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 394, False: 1.09M]
  |  |  |  Branch (98:27): [True: 198, False: 1.09M]
  |  |  ------------------
  |  |   99|    592|        cp++; \
  |  |  100|    592|    };
  ------------------
  168|  1.09M|    }
  169|    298|    *argv_out = apr_palloc(token_context, numargs * sizeof(char*));
  ------------------
  |  |  425|    298|    apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    298|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    298|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    298|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  170|       |
  171|       |    /*  determine first argument */
  172|  1.09M|    for (argnum = 0; argnum < (numargs-1); argnum++) {
  ------------------
  |  Branch (172:22): [True: 1.09M, False: 298]
  ------------------
  173|  1.09M|        SKIP_WHITESPACE(cp);
  ------------------
  |  |   98|  1.09M|    for ( ; *cp == ' ' || *cp == '\t'; ) { \
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 200, False: 1.09M]
  |  |  |  Branch (98:27): [True: 197, False: 1.09M]
  |  |  ------------------
  |  |   99|    397|        cp++; \
  |  |  100|    397|    };
  ------------------
  174|  1.09M|        CHECK_QUOTATION(cp, isquoted);
  ------------------
  |  |  103|  1.09M|    isquoted = 0; \
  |  |  104|  1.09M|    if (*cp == '"') { \
  |  |  ------------------
  |  |  |  Branch (104:9): [True: 548, False: 1.09M]
  |  |  ------------------
  |  |  105|    548|        isquoted = 1; \
  |  |  106|    548|        cp++; \
  |  |  107|    548|    } \
  |  |  108|  1.09M|    else if (*cp == '\'') { \
  |  |  ------------------
  |  |  |  Branch (108:14): [True: 1.08M, False: 1.15k]
  |  |  ------------------
  |  |  109|  1.08M|        isquoted = 2; \
  |  |  110|  1.08M|        cp++; \
  |  |  111|  1.08M|    }
  ------------------
  175|  1.09M|        ct = cp;
  176|  1.09M|        DETERMINE_NEXTSTRING(cp, isquoted);
  ------------------
  |  |  118|  4.23M|    for ( ; *cp != '\0'; cp++) { \
  |  |  ------------------
  |  |  |  Branch (118:13): [True: 4.23M, False: 240]
  |  |  ------------------
  |  |  119|  4.23M|        if (   (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \
  |  |  ------------------
  |  |  |  Branch (119:17): [True: 1.72k, False: 4.23M]
  |  |  |  Branch (119:33): [True: 201, False: 1.52k]
  |  |  |  Branch (119:51): [True: 199, False: 1.32k]
  |  |  ------------------
  |  |  120|  1.72k|                                *(cp+1) == '"' || *(cp+1) == '\''))) { \
  |  |  ------------------
  |  |  |  Branch (120:33): [True: 390, False: 937]
  |  |  |  Branch (120:51): [True: 224, False: 713]
  |  |  ------------------
  |  |  121|  1.01k|            cp++; \
  |  |  122|  1.01k|            continue; \
  |  |  123|  1.01k|        } \
  |  |  124|  4.23M|        if (   (!isquoted && (*cp == ' ' || *cp == '\t')) \
  |  |  ------------------
  |  |  |  Branch (124:17): [True: 3.14M, False: 1.09M]
  |  |  |  Branch (124:31): [True: 497, False: 3.14M]
  |  |  |  Branch (124:45): [True: 477, False: 3.14M]
  |  |  ------------------
  |  |  125|  4.23M|            || (isquoted == 1 && *cp == '"') \
  |  |  ------------------
  |  |  |  Branch (125:17): [True: 695, False: 4.23M]
  |  |  |  Branch (125:34): [True: 536, False: 159]
  |  |  ------------------
  |  |  126|  4.23M|            || (isquoted == 2 && *cp == '\'')                 ) { \
  |  |  ------------------
  |  |  |  Branch (126:17): [True: 1.08M, False: 3.14M]
  |  |  |  Branch (126:34): [True: 1.08M, False: 31]
  |  |  ------------------
  |  |  127|  1.09M|            break; \
  |  |  128|  1.09M|        } \
  |  |  129|  4.23M|    }
  ------------------
  177|  1.09M|        cp++;
  178|  1.09M|        (*argv_out)[argnum] = apr_palloc(token_context, cp - ct);
  ------------------
  |  |  425|  1.09M|    apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|  1.09M|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|  1.09M|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|  1.09M|#define APR_STRINGIFY_HELPER(n) #n
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  179|  1.09M|        apr_cpystrn((*argv_out)[argnum], ct, cp - ct);
  180|  1.09M|        cleaned = dirty = (*argv_out)[argnum];
  181|  1.09M|        REMOVE_ESCAPE_CHARS(cleaned, dirty, escaped);
  ------------------
  |  |  136|  1.09M|    escaped = 0; \
  |  |  137|  4.24M|    while(*dirty) { \
  |  |  ------------------
  |  |  |  Branch (137:11): [True: 3.14M, False: 1.09M]
  |  |  ------------------
  |  |  138|  3.14M|        if (!escaped && *dirty == '\\') { \
  |  |  ------------------
  |  |  |  Branch (138:13): [True: 3.14M, False: 1.39k]
  |  |  |  Branch (138:25): [True: 1.40k, False: 3.14M]
  |  |  ------------------
  |  |  139|  1.40k|            escaped = 1; \
  |  |  140|  1.40k|        } \
  |  |  141|  3.14M|        else { \
  |  |  142|  3.14M|            escaped = 0; \
  |  |  143|  3.14M|            *cleaned++ = *dirty; \
  |  |  144|  3.14M|        } \
  |  |  145|  3.14M|        ++dirty; \
  |  |  146|  3.14M|    } \
  |  |  147|  1.09M|    *cleaned = 0;        /* last line of macro... */
  ------------------
  182|  1.09M|    }
  183|    298|    (*argv_out)[argnum] = NULL;
  184|       |
  185|    298|    return APR_SUCCESS;
  ------------------
  |  |  225|    298|#define APR_SUCCESS 0
  ------------------
  186|    298|}

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

