[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: [PATCH] fix small memory leak in base_dir_entries

From: C. Michael Pilato <cmpilato_at_collab.net>
Date: Thu, 13 Mar 2008 15:10:37 -0400

Karl Fogel wrote:
> "Garrett Rooney" <rooneg_at_electricjellyfish.net> writes:
>> --- subversion/libsvn_fs_base/tree.c (revision 29895)
>> +++ subversion/libsvn_fs_base/tree.c (working copy)
>> @@ -1451,6 +1451,7 @@
>> apr_pool_t *pool)
>> {
>> struct dir_entries_args args;
>> + apr_pool_t *subpool;
>> apr_hash_t *table;
>> svn_fs_t *fs = root->fs;
>> apr_hash_index_t *hi;
>> @@ -1461,6 +1462,8 @@
>> SVN_ERR(svn_fs_base__retry_txn(root->fs, txn_body_dir_entries, &args,
>> pool));
>>
>> + subpool = svn_pool_create(pool);
>> +
>> /* Add in the kind data. */
>> for (hi = apr_hash_first(pool, table); hi; hi = apr_hash_next(hi))
>> {
>> @@ -1468,16 +1471,20 @@
>> struct node_kind_args nk_args;
>> void *val;
>>
>> + svn_pool_clear(subpool);
>> +
>> /* KEY will be the entry name in ancestor (about which we
>> simple don't care), VAL the dirent. */
>> apr_hash_this(hi, NULL, NULL, &val);
>> entry = val;
>> nk_args.id = entry->id;
>> SVN_ERR(svn_fs_base__retry_txn(fs, txn_body_node_kind, &nk_args,
>> - pool));
>> + subpool));
>> entry->kind = nk_args.kind;
>> }
>>
>> + svn_pool_destroy(subpool);
>> +
>> *table_p = table;
>> return SVN_NO_ERROR;
>> }
>
> I think we call it 'iterpool' now as a matter of convention (this bit me
> a few times too, until I caught on to what the young 'uns were doing).
>
> Patch looks good otherwise. I can't see any opportunity for lifetime
> problems, since the only thing we save from the loop is the enum 'kind'.

Agree, patch is good. +1 on s/subpool/iterpool/.

Though, it'd be unbearably difficult for me not to fix the "simple" ->
"simply" typo while committing it.

-- 
C. Michael Pilato <cmpilato_at_collab.net>
CollabNet   <>   www.collab.net   <>   Distributed Development On Demand

Received on 2008-03-13 20:10:49 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.