[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: Karl Fogel <kfogel_at_red-bean.com>
Date: Thu, 13 Mar 2008 15:05:54 -0400

"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'.

-Karl

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org
For additional commands, e-mail: dev-help_at_subversion.tigris.org
Received on 2008-03-13 20:06:15 CET

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