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

(-)httpd-2.2.21.orig/modules/dav/fs/repos.c (-2 / +27 lines)
Lines 1431-1436 static dav_error * dav_fs_walker(dav_fs_ Link Here
1431
    apr_finfo_t dirent;
1431
    apr_finfo_t dirent;
1432
    apr_dir_t *dirp;
1432
    apr_dir_t *dirp;
1433
    apr_pool_t *subpool;
1433
    apr_pool_t *subpool;
1434
    apr_pool_t *save_res1_pool;
1435
    apr_pool_t *save_res2_pool;
1434
1436
1435
    /* ensure the context is prepared properly, then call the func */
1437
    /* ensure the context is prepared properly, then call the func */
1436
    err = (*params->func)(&fsctx->wres,
1438
    err = (*params->func)(&fsctx->wres,
Lines 1472-1478 static dav_error * dav_fs_walker(dav_fs_ Link Here
1472
        /* ### need a better error */
1474
        /* ### need a better error */
1473
        return dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL);
1475
        return dav_new_error(pool, HTTP_NOT_FOUND, 0, NULL);
1474
    }
1476
    }
1477
1478
    /* do not share resource pools with childs, so that we can reuse memory */
1475
    apr_pool_create(&subpool, pool);
1479
    apr_pool_create(&subpool, pool);
1480
    save_res1_pool = fsctx->res1.pool;
1481
    save_res2_pool = fsctx->res2.pool;
1482
    fsctx->res1.pool = subpool;
1483
    if (fsctx->res2.pool)
1484
        fsctx->res2.pool = subpool;
1485
1476
    while ((apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp)) == APR_SUCCESS) {
1486
    while ((apr_dir_read(&dirent, APR_FINFO_DIRENT, dirp)) == APR_SUCCESS) {
1477
        apr_size_t len;
1487
        apr_size_t len;
1478
        apr_status_t status;
1488
        apr_status_t status;
Lines 1561-1566 static dav_error * dav_fs_walker(dav_fs_ Link Here
1561
            /* ### don't always want to quit on error from single child */
1571
            /* ### don't always want to quit on error from single child */
1562
            if ((err = dav_fs_walker(fsctx, depth - 1)) != NULL) {
1572
            if ((err = dav_fs_walker(fsctx, depth - 1)) != NULL) {
1563
                /* ### maybe add a higher-level description? */
1573
                /* ### maybe add a higher-level description? */
1574
                /* ### any returned error would have to be deep-copied
1575
                       to pool since it may have been allocated in a
1576
                       subpool that will be destroyed before the
1577
                       request terminates. */
1564
                break;
1578
                break;
1565
            }
1579
            }
1566
1580
Lines 1578-1589 static dav_error * dav_fs_walker(dav_fs_ Link Here
1578
1592
1579
    /* ### check the return value of this? */
1593
    /* ### check the return value of this? */
1580
    apr_dir_close(dirp);
1594
    apr_dir_close(dirp);
1581
    apr_pool_destroy(subpool);
1595
1582
    subpool = NULL;
1596
    /* restore parent resource pools and get rid of children's pool */
1597
    fsctx->res1.pool = save_res1_pool;
1598
    fsctx->res2.pool = save_res2_pool;
1599
1600
    /* If an error occurs the subpool is not destroyed since the error
1601
     * may have been allocated from it, so the error allocation will
1602
     * have the same lifetime as the main pool. */
1603
    /* ### It would be cleaner to deep-copy the error objet to the
1604
     * main pool as suggested above.*/
1583
1605
1584
    if (err != NULL)
1606
    if (err != NULL)
1585
        return err;
1607
        return err;
1586
1608
1609
    apr_pool_destroy(subpool);
1610
    subpool = NULL;
1611
1587
    if (params->walk_type & DAV_WALKTYPE_LOCKNULL) {
1612
    if (params->walk_type & DAV_WALKTYPE_LOCKNULL) {
1588
        apr_size_t offset = 0;
1613
        apr_size_t offset = 0;
1589
1614

Return to bug 48130