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

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

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

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

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|  1.09M|        for (; d < end; ++d, ++src) {
  ------------------
  |  Branch (58:16): [True: 4.56k, False: 1.09M]
  ------------------
   59|  4.56k|            if (!(*d = *src)) {
  ------------------
  |  Branch (59:17): [True: 0, False: 4.56k]
  ------------------
   60|      0|                return (d);
   61|      0|            }
   62|  4.56k|        }
   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|    284|{
   91|    284|    const char *cp;
   92|    284|    const char *ct;
   93|    284|    char *cleaned, *dirty;
   94|    284|    int escaped;
   95|    284|    int isquoted, numargs = 0, argnum;
   96|       |
   97|    284|#define SKIP_WHITESPACE(cp) \
   98|    284|    for ( ; *cp == ' ' || *cp == '\t'; ) { \
   99|    284|        cp++; \
  100|    284|    };
  101|       |
  102|    284|#define CHECK_QUOTATION(cp,isquoted) \
  103|    284|    isquoted = 0; \
  104|    284|    if (*cp == '"') { \
  105|    284|        isquoted = 1; \
  106|    284|        cp++; \
  107|    284|    } \
  108|    284|    else if (*cp == '\'') { \
  109|    284|        isquoted = 2; \
  110|    284|        cp++; \
  111|    284|    }
  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|    284|#define DETERMINE_NEXTSTRING(cp,isquoted) \
  118|    284|    for ( ; *cp != '\0'; cp++) { \
  119|    284|        if (   (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \
  120|    284|                                *(cp+1) == '"' || *(cp+1) == '\''))) { \
  121|    284|            cp++; \
  122|    284|            continue; \
  123|    284|        } \
  124|    284|        if (   (!isquoted && (*cp == ' ' || *cp == '\t')) \
  125|    284|            || (isquoted == 1 && *cp == '"') \
  126|    284|            || (isquoted == 2 && *cp == '\'')                 ) { \
  127|    284|            break; \
  128|    284|        } \
  129|    284|    }
  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|    284|#define REMOVE_ESCAPE_CHARS(cleaned, dirty, escaped) \
  136|    284|    escaped = 0; \
  137|    284|    while(*dirty) { \
  138|    284|        if (!escaped && *dirty == '\\') { \
  139|    284|            escaped = 1; \
  140|    284|        } \
  141|    284|        else { \
  142|    284|            escaped = 0; \
  143|    284|            *cleaned++ = *dirty; \
  144|    284|        } \
  145|    284|        ++dirty; \
  146|    284|    } \
  147|    284|    *cleaned = 0;        /* last line of macro... */
  148|       |
  149|    284|    cp = arg_str;
  150|    284|    SKIP_WHITESPACE(cp);
  ------------------
  |  |   98|    845|    for ( ; *cp == ' ' || *cp == '\t'; ) { \
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 199, False: 646]
  |  |  |  Branch (98:27): [True: 362, False: 284]
  |  |  ------------------
  |  |   99|    561|        cp++; \
  |  |  100|    561|    };
  ------------------
  151|    284|    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|    284|    numargs = 1;
  160|  1.09M|    while (*ct != '\0') {
  ------------------
  |  Branch (160:12): [True: 1.09M, False: 284]
  ------------------
  161|  1.09M|        CHECK_QUOTATION(ct, isquoted);
  ------------------
  |  |  103|  1.09M|    isquoted = 0; \
  |  |  104|  1.09M|    if (*cp == '"') { \
  |  |  ------------------
  |  |  |  Branch (104:9): [True: 769, False: 1.09M]
  |  |  ------------------
  |  |  105|    769|        isquoted = 1; \
  |  |  106|    769|        cp++; \
  |  |  107|    769|    } \
  |  |  108|  1.09M|    else if (*cp == '\'') { \
  |  |  ------------------
  |  |  |  Branch (108:14): [True: 1.08M, False: 1.37k]
  |  |  ------------------
  |  |  109|  1.08M|        isquoted = 2; \
  |  |  110|  1.08M|        cp++; \
  |  |  111|  1.08M|    }
  ------------------
  162|  1.09M|        DETERMINE_NEXTSTRING(ct, isquoted);
  ------------------
  |  |  118|  1.09M|    for ( ; *cp != '\0'; cp++) { \
  |  |  ------------------
  |  |  |  Branch (118:13): [True: 1.09M, False: 223]
  |  |  ------------------
  |  |  119|  1.09M|        if (   (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \
  |  |  ------------------
  |  |  |  Branch (119:17): [True: 1.59k, False: 1.09M]
  |  |  |  Branch (119:33): [True: 363, False: 1.22k]
  |  |  |  Branch (119:51): [True: 309, False: 918]
  |  |  ------------------
  |  |  120|  1.59k|                                *(cp+1) == '"' || *(cp+1) == '\''))) { \
  |  |  ------------------
  |  |  |  Branch (120:33): [True: 198, False: 720]
  |  |  |  Branch (120:51): [True: 201, False: 519]
  |  |  ------------------
  |  |  121|  1.07k|            cp++; \
  |  |  122|  1.07k|            continue; \
  |  |  123|  1.07k|        } \
  |  |  124|  1.09M|        if (   (!isquoted && (*cp == ' ' || *cp == '\t')) \
  |  |  ------------------
  |  |  |  Branch (124:17): [True: 3.43k, False: 1.08M]
  |  |  |  Branch (124:31): [True: 789, False: 2.64k]
  |  |  |  Branch (124:45): [True: 417, False: 2.22k]
  |  |  ------------------
  |  |  125|  1.09M|            || (isquoted == 1 && *cp == '"') \
  |  |  ------------------
  |  |  |  Branch (125:17): [True: 919, False: 1.09M]
  |  |  |  Branch (125:34): [True: 755, False: 164]
  |  |  ------------------
  |  |  126|  1.09M|            || (isquoted == 2 && *cp == '\'')                 ) { \
  |  |  ------------------
  |  |  |  Branch (126:17): [True: 1.08M, False: 2.39k]
  |  |  |  Branch (126:34): [True: 1.08M, False: 27]
  |  |  ------------------
  |  |  127|  1.09M|            break; \
  |  |  128|  1.09M|        } \
  |  |  129|  1.09M|    }
  ------------------
  163|  1.09M|        if (*ct != '\0') {
  ------------------
  |  Branch (163:13): [True: 1.09M, False: 223]
  ------------------
  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: 393, False: 1.09M]
  |  |  |  Branch (98:27): [True: 320, False: 1.09M]
  |  |  ------------------
  |  |   99|    713|        cp++; \
  |  |  100|    713|    };
  ------------------
  168|  1.09M|    }
  169|    284|    *argv_out = apr_palloc(token_context, numargs * sizeof(char*));
  ------------------
  |  |  425|    284|    apr_palloc_debug(p, size, APR_POOL__FILE_LINE__)
  |  |  ------------------
  |  |  |  |  143|    284|#define APR_POOL__FILE_LINE__ __FILE__ ":" APR_STRINGIFY(__LINE__)
  |  |  |  |  ------------------
  |  |  |  |  |  |  160|    284|#define APR_STRINGIFY(n) APR_STRINGIFY_HELPER(n)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  162|    284|#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: 284]
  ------------------
  173|  1.09M|        SKIP_WHITESPACE(cp);
  ------------------
  |  |   98|  1.09M|    for ( ; *cp == ' ' || *cp == '\t'; ) { \
  |  |  ------------------
  |  |  |  Branch (98:13): [True: 199, False: 1.09M]
  |  |  |  Branch (98:27): [True: 302, False: 1.09M]
  |  |  ------------------
  |  |   99|    501|        cp++; \
  |  |  100|    501|    };
  ------------------
  174|  1.09M|        CHECK_QUOTATION(cp, isquoted);
  ------------------
  |  |  103|  1.09M|    isquoted = 0; \
  |  |  104|  1.09M|    if (*cp == '"') { \
  |  |  ------------------
  |  |  |  Branch (104:9): [True: 769, False: 1.09M]
  |  |  ------------------
  |  |  105|    769|        isquoted = 1; \
  |  |  106|    769|        cp++; \
  |  |  107|    769|    } \
  |  |  108|  1.09M|    else if (*cp == '\'') { \
  |  |  ------------------
  |  |  |  Branch (108:14): [True: 1.08M, False: 1.37k]
  |  |  ------------------
  |  |  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|  1.09M|    for ( ; *cp != '\0'; cp++) { \
  |  |  ------------------
  |  |  |  Branch (118:13): [True: 1.09M, False: 223]
  |  |  ------------------
  |  |  119|  1.09M|        if (   (*cp == '\\' && (*(cp+1) == ' ' || *(cp+1) == '\t' || \
  |  |  ------------------
  |  |  |  Branch (119:17): [True: 1.59k, False: 1.09M]
  |  |  |  Branch (119:33): [True: 363, False: 1.22k]
  |  |  |  Branch (119:51): [True: 309, False: 918]
  |  |  ------------------
  |  |  120|  1.59k|                                *(cp+1) == '"' || *(cp+1) == '\''))) { \
  |  |  ------------------
  |  |  |  Branch (120:33): [True: 198, False: 720]
  |  |  |  Branch (120:51): [True: 201, False: 519]
  |  |  ------------------
  |  |  121|  1.07k|            cp++; \
  |  |  122|  1.07k|            continue; \
  |  |  123|  1.07k|        } \
  |  |  124|  1.09M|        if (   (!isquoted && (*cp == ' ' || *cp == '\t')) \
  |  |  ------------------
  |  |  |  Branch (124:17): [True: 3.43k, False: 1.08M]
  |  |  |  Branch (124:31): [True: 789, False: 2.64k]
  |  |  |  Branch (124:45): [True: 417, False: 2.22k]
  |  |  ------------------
  |  |  125|  1.09M|            || (isquoted == 1 && *cp == '"') \
  |  |  ------------------
  |  |  |  Branch (125:17): [True: 919, False: 1.09M]
  |  |  |  Branch (125:34): [True: 755, False: 164]
  |  |  ------------------
  |  |  126|  1.09M|            || (isquoted == 2 && *cp == '\'')                 ) { \
  |  |  ------------------
  |  |  |  Branch (126:17): [True: 1.08M, False: 2.39k]
  |  |  |  Branch (126:34): [True: 1.08M, False: 27]
  |  |  ------------------
  |  |  127|  1.09M|            break; \
  |  |  128|  1.09M|        } \
  |  |  129|  1.09M|    }
  ------------------
  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|  1.09M|    while(*dirty) { \
  |  |  ------------------
  |  |  |  Branch (137:11): [True: 4.56k, False: 1.09M]
  |  |  ------------------
  |  |  138|  4.56k|        if (!escaped && *dirty == '\\') { \
  |  |  ------------------
  |  |  |  Branch (138:13): [True: 3.21k, False: 1.34k]
  |  |  |  Branch (138:25): [True: 1.35k, False: 1.85k]
  |  |  ------------------
  |  |  139|  1.35k|            escaped = 1; \
  |  |  140|  1.35k|        } \
  |  |  141|  4.56k|        else { \
  |  |  142|  3.20k|            escaped = 0; \
  |  |  143|  3.20k|            *cleaned++ = *dirty; \
  |  |  144|  3.20k|        } \
  |  |  145|  4.56k|        ++dirty; \
  |  |  146|  4.56k|    } \
  |  |  147|  1.09M|    *cleaned = 0;        /* last line of macro... */
  ------------------
  182|  1.09M|    }
  183|    284|    (*argv_out)[argnum] = NULL;
  184|       |
  185|    284|    return APR_SUCCESS;
  ------------------
  |  |  225|    284|#define APR_SUCCESS 0
  ------------------
  186|    284|}

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

