The following patch:
[[[
Index: subversion/libsvn_subr/svn_cache_config.c
===================================================================
--- subversion/libsvn_subr/svn_cache_config.c (revision 1152032)
+++ subversion/libsvn_subr/svn_cache_config.c (working copy)
@@ -113,6 +113,7 @@ svn_cache__get_global_membuffer_cache(void)
apr_pool_create_ex(&pool, NULL, NULL, allocator);
if (pool == NULL)
return NULL;
+ apr_allocator_owner_set(allocator, pool);
err = svn_cache__membuffer_cache_create(
&new_cache,
]]]
causes the following valgrind warning to disappear:
[[[
==28089== 104 bytes in 1 blocks are definitely lost in loss record 1 of 1
==28089== at 0x4023F50: malloc (vg_replace_malloc.c:236)
==28089== by 0x41E7F7E: apr_allocator_create (apr_pools.c:124)
==28089== by 0x419B16F: svn_cache__get_global_membuffer_cache
(svn_cache_config.c:94)
==28089== by 0x457B5FC: svn_fs_fs__initialize_caches (caching.c:261)
==28089== by 0x457F117: fs_create (fs.c:192)
==28089== by 0x43D396F: svn_fs_create (fs-loader.c:411)
==28089== by 0x43C04E5: svn_repos_create (repos.c:1260)
==28089== by 0x4097949: svn_test__create_repos (svn_test_fs.c:215)
==28089== by 0x805FBC0: create_repos_and_wc (utils.c:77)
==28089== by 0x805FFF5: svn_test__sandbox_create (utils.c:151)
==28089== by 0x805390B: test_delete_of_replace (op-depth-test.c:1792)
==28089== by 0x409AE1D: do_test_num (svn_test_main.c:275)
]]]
Can I have a +1? I looked up the APR docs, but they were less than useful.
% libtool --mode=execute valgrind --leak-check=full ./op-depth-test 14
==28089== Memcheck, a memory error detector
==28089== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==28089== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for
copyright info
==28089== Command:
/home/daniel/src/svn/t1/subversion/tests/libsvn_wc/.libs/lt-op-depth-test 14
==28089==
PASS: lt-op-depth-test 14: test_delete_of_replace
==28089== Invalid free() / delete / delete[]
==28089== at 0x4023B6A: free (vg_replace_malloc.c:366)
==28089== by 0x4333E43: free_mem (in /lib/i686/cmov/libc-2.11.2.so)
==28089== by 0x4333909: __libc_freeres (in /lib/i686/cmov/libc-2.11.2.so)
==28089== by 0x401F4D3: _vgnU_freeres (vg_preloaded.c:62)
==28089== by 0x42BE863: _Exit (_exit.S:30)
==28089== by 0x425632E: exit (exit.c:100)
==28089== by 0x423DC7D: (below main) (libc-start.c:260)
==28089== Address 0x4603000 is not stack'd, malloc'd or (recently) free'd
==28089==
==28089==
==28089== HEAP SUMMARY:
==28089== in use at exit: 104 bytes in 1 blocks
==28089== total heap usage: 35,094 allocs, 35,106 frees, 48,343,565 bytes
allocated
==28089==
==28089== 104 bytes in 1 blocks are definitely lost in loss record 1 of 1
==28089== at 0x4023F50: malloc (vg_replace_malloc.c:236)
==28089== by 0x41E7F7E: apr_allocator_create (apr_pools.c:124)
==28089== by 0x419B16F: svn_cache__get_global_membuffer_cache
(svn_cache_config.c:94)
==28089== by 0x457B5FC: svn_fs_fs__initialize_caches (caching.c:261)
==28089== by 0x457F117: fs_create (fs.c:192)
==28089== by 0x43D396F: svn_fs_create (fs-loader.c:411)
==28089== by 0x43C04E5: svn_repos_create (repos.c:1260)
==28089== by 0x4097949: svn_test__create_repos (svn_test_fs.c:215)
==28089== by 0x805FBC0: create_repos_and_wc (utils.c:77)
==28089== by 0x805FFF5: svn_test__sandbox_create (utils.c:151)
==28089== by 0x805390B: test_delete_of_replace (op-depth-test.c:1792)
==28089== by 0x409AE1D: do_test_num (svn_test_main.c:275)
==28089==
==28089== LEAK SUMMARY:
==28089== definitely lost: 104 bytes in 1 blocks
==28089== indirectly lost: 0 bytes in 0 blocks
==28089== possibly lost: 0 bytes in 0 blocks
==28089== still reachable: 0 bytes in 0 blocks
==28089== suppressed: 0 bytes in 0 blocks
==28089==
==28089== For counts of detected and suppressed errors, rerun with: -v
==28089== ERROR SUMMARY: 14 errors from 2 contexts (suppressed: 92 from 7)
% libtool --mode=execute valgrind --leak-check=full ./op-depth-test 14
==30348== Memcheck, a memory error detector
==30348== Copyright (C) 2002-2010, and GNU GPL'd, by Julian Seward et al.
==30348== Using Valgrind-3.6.0.SVN-Debian and LibVEX; rerun with -h for
copyright info
==30348== Command:
/home/daniel/src/svn/t1/subversion/tests/libsvn_wc/.libs/lt-op-depth-test 14
==30348==
PASS: lt-op-depth-test 14: test_delete_of_replace
==30348== Invalid free() / delete / delete[]
==30348== at 0x4023B6A: free (vg_replace_malloc.c:366)
==30348== by 0x4333E43: free_mem (in /lib/i686/cmov/libc-2.11.2.so)
==30348== by 0x4333909: __libc_freeres (in /lib/i686/cmov/libc-2.11.2.so)
==30348== by 0x401F4D3: _vgnU_freeres (vg_preloaded.c:62)
==30348== by 0x42BE863: _Exit (_exit.S:30)
==30348== by 0x425632E: exit (exit.c:100)
==30348== by 0x423DC7D: (below main) (libc-start.c:260)
==30348== Address 0x4603000 is not stack'd, malloc'd or (recently) free'd
==30348==
==30348==
==30348== HEAP SUMMARY:
==30348== in use at exit: 0 bytes in 0 blocks
==30348== total heap usage: 35,094 allocs, 35,107 frees, 48,343,565 bytes
allocated
==30348==
==30348== All heap blocks were freed -- no leaks are possible
==30348==
==30348== For counts of detected and suppressed errors, rerun with: -v
==30348== ERROR SUMMARY: 13 errors from 1 contexts (suppressed: 92 from 7)