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
]]]
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;

Reply via email to