You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Sergey Raevskiy <se...@visualsvn.com> on 2015/02/12 14:18:17 UTC

[PATCH] Fix pool usage in FSFS locking code

Hi!

I've noticed an improper pool usage in FSFS code.  The svn_lock_t * object is
created in RESULT_POOL, but its fiels are not gettting pstrdup'ed.

The patch with fix is attached.

Log message:
[[[
* subversion/libsvn_fs_fs/lock.c
  (lock_body): Fix pool usage. Call apr_pstrdup() when initializing svn_lock_t
   fields.

Patch by: sergey.raevskiy{_AT_}visualsvn.com
]]]

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

Posted by Sergey Raevskiy <se...@visualsvn.com>.
> 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).

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

Posted by Philip Martin <ph...@wandisco.com>.
Sergey Raevskiy <se...@visualsvn.com> 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*