diff options
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | tables/apr_tables.c | 16 |
2 files changed, 11 insertions, 8 deletions
@@ -1,5 +1,8 @@ Changes for APR 1.2.0 + *) Fix apr_table_overlap()'s handling of tables allocated from + different pools. [Joe Schaefer <joe+gmane@sunstarsys.com>] + *) Add support for uuid_generate on OS X 10.4. [Paul Querna] *) Include the C preprocessor flags in --cflags for pkg-config. diff --git a/tables/apr_tables.c b/tables/apr_tables.c index e86c1becc..da17e2867 100644 --- a/tables/apr_tables.c +++ b/tables/apr_tables.c @@ -1191,18 +1191,18 @@ static void apr_table_cat(apr_table_t *t, const apr_table_t *s) APR_DECLARE(void) apr_table_overlap(apr_table_t *a, const apr_table_t *b, unsigned flags) { - const int m = a->a.nelts; - const int n = b->a.nelts; - apr_pool_t *p = b->a.pool; - - if (m + n == 0) { + if (a->a.nelts + b->a.nelts == 0) { return; } - /* copy (extend) a using b's pool */ - if (a->a.pool != p) { - make_array_core(&a->a, p, m+n, sizeof(apr_table_entry_t), 0); +#if APR_POOL_DEBUG + /* Since the keys and values are not copied, it's required that + * b->a.pool has a lifetime at least as long as a->a.pool. */ + if (!apr_pool_is_ancestor(b->a.pool, a->a.pool)) { + fprintf(stderr, "apr_table_overlap: b's pool is not an ancestor of a's\n"); + abort(); } +#endif apr_table_cat(a, b); |