Re: [PATCH] Fix pool usage in FSFS locking code

2015-02-12 Thread Sergey Raevskiy
> I think info->path is already in the correct pool, it's the result of
> processing the the input path through svn_fspath__canonicalize using
> result_pool.

Yes, INFO->PATH is alocated in correct pool already.  I've attached a new
version of my patch (log message remains the same).
Index: subversion/libsvn_fs_fs/lock.c
===
--- subversion/libsvn_fs_fs/lock.c  (revision 1659239)
+++ subversion/libsvn_fs_fs/lock.c  (working copy)
@@ -900,14 +900,17 @@ lock_body(void *baton, apr_pool_t *pool)
 {
   info->lock = svn_lock_create(lb->result_pool);
   if (target->token)
-info->lock->token = target->token;
+info->lock->token = apr_pstrdup(lb->result_pool, target->token);
   else
 SVN_ERR(svn_fs_fs__generate_lock_token(&(info->lock->token), 
lb->fs,
lb->result_pool));
 
+  /* The INFO->PATH is already allocated in LB->RESULT_POOL as a result
+ of svn_fspath__canonicalize() (see svn_fs_fs__lock()). */
   info->lock->path = info->path;
-  info->lock->owner = lb->fs->access_ctx->username;
-  info->lock->comment = lb->comment;
+  info->lock->owner = apr_pstrdup(lb->result_pool,
+  lb->fs->access_ctx->username);
+  info->lock->comment = apr_pstrdup(lb->result_pool, lb->comment);
   info->lock->is_dav_comment = lb->is_dav_comment;
   info->lock->creation_date = apr_time_now();
   info->lock->expiration_date = lb->expiration_date;


Re: [PATCH] Fix pool usage in FSFS locking code

2015-02-12 Thread Philip Martin
Sergey Raevskiy  writes:

> Index: subversion/libsvn_fs_fs/lock.c
> ===
> --- subversion/libsvn_fs_fs/lock.c(revision 1659239)
> +++ subversion/libsvn_fs_fs/lock.c(working copy)
> @@ -900,14 +900,15 @@ lock_body(void *baton, apr_pool_t *pool)
>  {
>info->lock = svn_lock_create(lb->result_pool);
>if (target->token)
> -info->lock->token = target->token;
> +info->lock->token = apr_pstrdup(lb->result_pool, target->token);
>else
>  SVN_ERR(svn_fs_fs__generate_lock_token(&(info->lock->token), 
> lb->fs,
> lb->result_pool));
>  
> -  info->lock->path = info->path;
> -  info->lock->owner = lb->fs->access_ctx->username;
> -  info->lock->comment = lb->comment;
> +  info->lock->path = apr_pstrdup(lb->result_pool, info->path);
> +  info->lock->owner = apr_pstrdup(lb->result_pool,
> +  lb->fs->access_ctx->username);
> +  info->lock->comment = apr_pstrdup(lb->result_pool, lb->comment);
>info->lock->is_dav_comment = lb->is_dav_comment;
>info->lock->creation_date = apr_time_now();
>info->lock->expiration_date = lb->expiration_date;

I think info->path is already in the correct pool, it's the result of
processing the the input path through svn_fspath__canonicalize using
result_pool.

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*