View | Details | Raw Unified | Return to bug 48130
Collapse All | Expand All

(-)httpd-2.2.21.orig/modules/dav/main/mod_dav.c (-2 / +3 lines)
Lines 1935-1941 static dav_error * dav_propfind_walker(d Link Here
1935
    /* ### what to do about closing the propdb on server failure? */
1935
    /* ### what to do about closing the propdb on server failure? */
1936
1936
1937
    if (ctx->propfind_type == DAV_PROPFIND_IS_PROP) {
1937
    if (ctx->propfind_type == DAV_PROPFIND_IS_PROP) {
1938
        propstats = dav_get_props(propdb, ctx->doc);
1938
        propstats = dav_get_props2(propdb, ctx->doc, ctx->r->pool);
1939
    }
1939
    }
1940
    else {
1940
    else {
1941
        dav_prop_insert what = ctx->propfind_type == DAV_PROPFIND_IS_ALLPROP
1941
        dav_prop_insert what = ctx->propfind_type == DAV_PROPFIND_IS_ALLPROP
Lines 1943-1952 static dav_error * dav_propfind_walker(d Link Here
1943
                                 : DAV_PROP_INSERT_NAME;
1943
                                 : DAV_PROP_INSERT_NAME;
1944
        propstats = dav_get_allprops(propdb, what);
1944
        propstats = dav_get_allprops(propdb, what);
1945
    }
1945
    }
1946
    dav_close_propdb(propdb);
1947
1946
1948
    dav_stream_response(wres, 0, &propstats, ctx->scratchpool);
1947
    dav_stream_response(wres, 0, &propstats, ctx->scratchpool);
1949
1948
1949
    dav_close_propdb2(propdb);
1950
1950
    /* at this point, ctx->scratchpool has been used to stream a
1951
    /* at this point, ctx->scratchpool has been used to stream a
1951
       single response.  this function fully controls the pool, and
1952
       single response.  this function fully controls the pool, and
1952
       thus has the right to clear it for the next iteration of this
1953
       thus has the right to clear it for the next iteration of this
(-)httpd-2.2.21.orig/modules/dav/main/mod_dav.h (+19 lines)
Lines 1515-1524 DAV_DECLARE(dav_error *) dav_open_propdb Link Here
1515
1515
1516
DAV_DECLARE(void) dav_close_propdb(dav_propdb *db);
1516
DAV_DECLARE(void) dav_close_propdb(dav_propdb *db);
1517
1517
1518
/* This variant destroys the subpool used by *db, do not use if any
1519
 * props related functions not marked as safe is used on *db.
1520
 * WARNING: error returned from the propdb may have been allocated
1521
 * from the propdb's pool and thus not be accessibe after this call.
1522
 */
1523
void dav_close_propdb2(dav_propdb *db);
1524
1518
DAV_DECLARE(dav_get_props_result) dav_get_props(
1525
DAV_DECLARE(dav_get_props_result) dav_get_props(
1519
    dav_propdb *db,
1526
    dav_propdb *db,
1520
    apr_xml_doc *doc);
1527
    apr_xml_doc *doc);
1521
1528
1529
/* This variant uses the given pool to allocate *doc elements and thus
1530
 * allows reusing *doc across dav_open_propdb() and dav_close_propdb2()
1531
 * cycles.
1532
 * It is safe to use this function with dav_close_propdb2(), but the
1533
 * result is deallocated on dav_close_propdb2(). */
1534
dav_get_props_result dav_get_props2(
1535
    dav_propdb *propdb,
1536
    apr_xml_doc *doc,
1537
    apr_pool_t *docpool);
1538
1539
/* It is safe to use this function with dav_close_propdb2(), but the
1540
 * result is deallocated on dav_close_propdb2(). */
1522
DAV_DECLARE(dav_get_props_result) dav_get_allprops(
1541
DAV_DECLARE(dav_get_props_result) dav_get_allprops(
1523
    dav_propdb *db,
1542
    dav_propdb *db,
1524
    dav_prop_insert what);
1543
    dav_prop_insert what);
(-)httpd-2.2.21.orig/modules/dav/main/props.c (-3 / +25 lines)
Lines 520-526 DAV_DECLARE(dav_error *)dav_open_propdb( Link Here
520
                                        apr_array_header_t * ns_xlate,
520
                                        apr_array_header_t * ns_xlate,
521
                                        dav_propdb **p_propdb)
521
                                        dav_propdb **p_propdb)
522
{
522
{
523
    dav_propdb *propdb = apr_pcalloc(r->pool, sizeof(*propdb));
523
    apr_pool_t *p;
524
    dav_propdb *propdb;
525
526
    apr_pool_create(&p, r->pool);
527
528
    propdb = apr_pcalloc(p, sizeof(*propdb));
524
529
525
    *p_propdb = NULL;
530
    *p_propdb = NULL;
526
531
Lines 533-539 DAV_DECLARE(dav_error *)dav_open_propdb( Link Here
533
#endif
538
#endif
534
539
535
    propdb->r = r;
540
    propdb->r = r;
536
    apr_pool_create(&propdb->p, r->pool);
541
    propdb->p = p;
537
    propdb->resource = resource;
542
    propdb->resource = resource;
538
    propdb->ns_xlate = ns_xlate;
543
    propdb->ns_xlate = ns_xlate;
539
544
Lines 565-570 DAV_DECLARE(void) dav_close_propdb(dav_p Link Here
565
    return;
570
    return;
566
}
571
}
567
572
573
void dav_close_propdb2(dav_propdb *propdb)
574
{
575
    if (propdb->db != NULL) {
576
        (*propdb->db_hooks->close)(propdb->db);
577
    }
578
579
    apr_pool_destroy(propdb->p);
580
    return;
581
}
582
568
DAV_DECLARE(dav_get_props_result) dav_get_allprops(dav_propdb *propdb,
583
DAV_DECLARE(dav_get_props_result) dav_get_allprops(dav_propdb *propdb,
569
                                                   dav_prop_insert what)
584
                                                   dav_prop_insert what)
570
{
585
{
Lines 696-701 DAV_DECLARE(dav_get_props_result) dav_ge Link Here
696
DAV_DECLARE(dav_get_props_result) dav_get_props(dav_propdb *propdb,
711
DAV_DECLARE(dav_get_props_result) dav_get_props(dav_propdb *propdb,
697
                                                apr_xml_doc *doc)
712
                                                apr_xml_doc *doc)
698
{
713
{
714
    return dav_get_props2(propdb, doc, propdb->p);
715
}
716
717
dav_get_props_result dav_get_props2(dav_propdb *propdb,
718
                                    apr_xml_doc *doc,
719
                                    apr_pool_t *docpool)
720
{
699
    const dav_hooks_db *db_hooks = propdb->db_hooks;
721
    const dav_hooks_db *db_hooks = propdb->db_hooks;
700
    apr_xml_elem *elem = dav_find_child(doc->root, "prop");
722
    apr_xml_elem *elem = dav_find_child(doc->root, "prop");
701
    apr_text_header hdr_good = { 0 };
723
    apr_text_header hdr_good = { 0 };
Lines 736-742 DAV_DECLARE(dav_get_props_result) dav_ge Link Here
736
        */
758
        */
737
759
738
        if (elem->priv == NULL) {
760
        if (elem->priv == NULL) {
739
            elem->priv = apr_pcalloc(propdb->p, sizeof(*priv));
761
            elem->priv = apr_pcalloc(docpool, sizeof(*priv));
740
        }
762
        }
741
        priv = elem->priv;
763
        priv = elem->priv;
742
764

Return to bug 48130