Blob Blame History Raw
From 00f3b0495733691e6f61edde1211973b6cc74c6c Mon Sep 17 00:00:00 2001
From: Krutika Dhananjay <kdhananj@redhat.com>
Date: Tue, 29 Nov 2016 12:56:40 +0530
Subject: [PATCH 207/227] protocol/server: Fix mem-leaks in compound fops

        Backport of: http://review.gluster.org/15965

* Remove spurious 'return' statement.
* Free up 'compound_rsp_array_val' as well in the end.
* Remove multiple refs on this_args->xdata.

Change-Id: Ibeec3d3b5c41d34000bdd2d932c9ca76e565ce56
BUG: 1398315
Signed-off-by: Krutika Dhananjay <kdhananj@redhat.com>
Reviewed-on: https://code.engineering.redhat.com/gerrit/91746
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
---
 xlators/protocol/server/src/server-helpers.c | 303 ++++++++++-----------------
 1 file changed, 116 insertions(+), 187 deletions(-)

diff --git a/xlators/protocol/server/src/server-helpers.c b/xlators/protocol/server/src/server-helpers.c
index 1fe44dd..590662b 100644
--- a/xlators/protocol/server/src/server-helpers.c
+++ b/xlators/protocol/server/src/server-helpers.c
@@ -1363,6 +1363,8 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
 {
         int                     op_errno    = 0;
         int                     ret         = -1;
+        dict_t                 *xdata       = NULL;
+        dict_t                 *xattr       = NULL;
         struct iovec req_iovec[MAX_IOVEC]   = { {0,} };
         compound_req            *this_req   = NULL;
         server_state_t          *state      = CALL_STATE (frame);
@@ -1377,11 +1379,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_stat_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_stat_store (this_args, &state->loc, this_args->xdata);
+                args_stat_store (this_args, &state->loc, xdata);
                 break;
         }
         case GF_FOP_READLINK:
@@ -1391,12 +1392,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_readlink_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_readlink_store (this_args, &state->loc,
-                                     args->size, this_args->xdata);
+                args_readlink_store (this_args, &state->loc, args->size, xdata);
                 break;
         }
         case GF_FOP_MKNOD:
@@ -1406,13 +1405,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_mknod_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_mknod_store (this_args, &state->loc, args->mode,
-                                  args->dev, args->umask,
-                                  this_args->xdata);
+                args_mknod_store (this_args, &state->loc, args->mode, args->dev,
+                                  args->umask, xdata);
                 break;
         }
         case GF_FOP_MKDIR:
@@ -1422,12 +1419,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_mkdir_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 args_mkdir_store (this_args, &state->loc, args->mode,
-                                  args->umask, this_args->xdata);
+                                  args->umask, xdata);
                 break;
         }
         case GF_FOP_UNLINK:
@@ -1437,12 +1433,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_unlink_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_unlink_store (this_args, &state->loc,
-                                   args->xflags, this_args->xdata);
+                args_unlink_store (this_args, &state->loc, args->xflags, xdata);
                 break;
         }
         case GF_FOP_RMDIR:
@@ -1452,12 +1446,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_rmdir_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_rmdir_store (this_args, &state->loc,
-                                  args->xflags, this_args->xdata);
+                args_rmdir_store (this_args, &state->loc, args->xflags, xdata);
                 break;
         }
         case GF_FOP_SYMLINK:
@@ -1467,13 +1459,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_symlink_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_symlink_store (this_args, args->linkname,
-                                    &state->loc,
-                                    args->umask, this_args->xdata);
+                args_symlink_store (this_args, args->linkname, &state->loc,
+                                    args->umask, xdata);
 
                 this_args->loc.inode = inode_new (state->itable);
 
@@ -1486,13 +1476,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_rename_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
-                args_rename_store (this_args, &state->loc,
-                                   &state->loc2, this_args->xdata);
+                args_rename_store (this_args, &state->loc, &state->loc2, xdata);
                 break;
         }
         case GF_FOP_LINK:
@@ -1502,12 +1490,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_link_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_link_store (this_args, &state->loc,
-                                 &state->loc2, this_args->xdata);
+                args_link_store (this_args, &state->loc, &state->loc2, xdata);
 
                 this_args->loc2.inode = inode_ref (this_args->loc.inode);
 
@@ -1520,12 +1506,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_truncate_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_truncate_store (this_args, &state->loc,
-                                     args->offset, this_args->xdata);
+                args_truncate_store (this_args, &state->loc, args->offset,
+                                     xdata);
                 break;
         }
         case GF_FOP_OPEN:
@@ -1535,12 +1520,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_open_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_open_store (this_args, &state->loc,
-                                 args->flags, state->fd, this_args->xdata);
+                args_open_store (this_args, &state->loc, args->flags, state->fd,
+                                 xdata);
 
                 this_args->fd = fd_create (this_args->loc.inode,
                                            frame->root->pid);
@@ -1555,13 +1539,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_read_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 args_readv_store (this_args, state->fd, args->size,
-                                  args->offset, args->flag,
-                                  this_args->xdata);
+                                  args->offset, args->flag, xdata);
                 break;
         }
         case GF_FOP_WRITE:
@@ -1576,8 +1558,7 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 req_iovec[0].iov_len  = args->size;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 /* The way writev fop works :
@@ -1591,11 +1572,9 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                  * GF_FOP_WRITE section of client_handle_fop_requirements()
                  * in protocol client.
                  */
-                args_writev_store (this_args, state->fd,
-                                   req_iovec,
-                                   1, args->offset,
-                                   args->flag,
-                                   state->iobref, this_args->xdata);
+                args_writev_store (this_args, state->fd, req_iovec, 1,
+                                   args->offset, args->flag, state->iobref,
+                                   xdata);
                 state->write_length += req_iovec[0].iov_len;
                 break;
         }
@@ -1606,12 +1585,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_statfs_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_statfs_store (this_args, &state->loc,
-                                   this_args->xdata);
+                args_statfs_store (this_args, &state->loc, xdata);
                 break;
         }
         case GF_FOP_FLUSH:
@@ -1621,11 +1598,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_flush_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_flush_store (this_args, state->fd, this_args->xdata);
+                args_flush_store (this_args, state->fd, xdata);
                 break;
         }
         case GF_FOP_FSYNC:
@@ -1635,12 +1611,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fsync_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_fsync_store (this_args, state->fd,
-                                  args->data, this_args->xdata);
+                args_fsync_store (this_args, state->fd, args->data, xdata);
                 break;
         }
         case GF_FOP_SETXATTR:
@@ -1650,18 +1624,15 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_setxattr_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xattr,
-                                              args->dict.dict_val,
+                                              xattr, args->dict.dict_val,
                                               args->dict.dict_len, ret,
                                               op_errno, out);
-                args_setxattr_store (this_args, &state->loc,
-                                     this_args->xattr, args->flags,
-                                     this_args->xdata);
+                args_setxattr_store (this_args, &state->loc, xattr, args->flags,
+                                     xdata);
                 break;
         }
         case GF_FOP_GETXATTR:
@@ -1671,14 +1642,12 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_getxattr_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 gf_server_check_getxattr_cmd (frame, args->name);
 
-                args_getxattr_store (this_args, &state->loc,
-                                     args->name, this_args->xdata);
+                args_getxattr_store (this_args, &state->loc, args->name, xdata);
                 break;
         }
         case GF_FOP_REMOVEXATTR:
@@ -1688,13 +1657,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_removexattr_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_removexattr_store (this_args, &state->loc,
-                                        args->name,
-                                        this_args->xdata);
+                args_removexattr_store (this_args, &state->loc, args->name,
+                                        xdata);
                 break;
         }
         case GF_FOP_OPENDIR:
@@ -1712,12 +1679,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                         goto out;
                 }
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
+                                              xdata,
                                               args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_opendir_store (this_args, &state->loc,
-                                    state->fd, this_args->xdata);
+                args_opendir_store (this_args, &state->loc, state->fd, xdata);
                 break;
         }
         case GF_FOP_FSYNCDIR:
@@ -1727,12 +1693,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fsyncdir_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_fsyncdir_store (this_args, state->fd,
-                                     args->data, this_args->xdata);
+                args_fsyncdir_store (this_args, state->fd, args->data, xdata);
                 break;
         }
         case GF_FOP_ACCESS:
@@ -1742,12 +1706,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_access_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_access_store (this_args, &state->loc,
-                                   args->mask, this_args->xdata);
+                args_access_store (this_args, &state->loc, args->mask, xdata);
                 break;
         }
         case GF_FOP_CREATE:
@@ -1770,14 +1732,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 state->fd->flags = state->flags;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_create_store (this_args, &state->loc,
-                                   args->flags, args->mode,
-                                   args->umask, state->fd,
-                                   this_args->xdata);
+                args_create_store (this_args, &state->loc, args->flags,
+                                   args->mode, args->umask, state->fd, xdata);
                 break;
         }
         case GF_FOP_FTRUNCATE:
@@ -1787,13 +1746,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_ftruncate_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_ftruncate_store (this_args, state->fd,
-                                      args->offset,
-                                      this_args->xdata);
+                args_ftruncate_store (this_args, state->fd, args->offset,
+                                      xdata);
                 break;
         }
         case GF_FOP_FSTAT:
@@ -1803,11 +1760,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fstat_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_fstat_store (this_args, state->fd, this_args->xdata);
+                args_fstat_store (this_args, state->fd, xdata);
                 break;
         }
         case GF_FOP_LK:
@@ -1817,8 +1773,7 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_lk_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
@@ -1869,7 +1824,7 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                         break;
                 }
                 args_lk_store (this_args, state->fd, this_args->cmd,
-                               &this_args->lock, this_args->xdata);
+                               &this_args->lock, xdata);
                 break;
         }
         case GF_FOP_LOOKUP:
@@ -1885,11 +1840,10 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                         state->is_revalidate = 1;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_lookup_store (this_args, &state->loc, this_args->xdata);
+                args_lookup_store (this_args, &state->loc, xdata);
                 break;
         }
         case GF_FOP_READDIR:
@@ -1899,12 +1853,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_readdir_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 args_readdir_store (this_args, state->fd, args->size,
-                                    args->offset, this_args->xdata);
+                                    args->offset, xdata);
                 break;
         }
         case GF_FOP_INODELK:
@@ -1940,13 +1893,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 }
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 args_inodelk_store (this_args, args->volume, &state->loc,
-                                    this_args->cmd,
-                                    &this_args->lock, this_args->xdata);
+                                    this_args->cmd, &this_args->lock, xdata);
                 break;
         }
         case GF_FOP_FINODELK:
@@ -1956,8 +1907,7 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_finodelk_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
@@ -1987,8 +1937,7 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                         break;
                 }
                 args_finodelk_store (this_args, args->volume, state->fd,
-                                     this_args->cmd,
-                                     &this_args->lock, this_args->xdata);
+                                     this_args->cmd, &this_args->lock, xdata);
                         break;
         }
         case GF_FOP_ENTRYLK:
@@ -1998,13 +1947,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_entrylk_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 args_entrylk_store (this_args, args->volume, &state->loc,
-                                    args->name, args->cmd, args->type,
-                                    this_args->xdata);
+                                    args->name, args->cmd, args->type, xdata);
                 break;
         }
         case GF_FOP_FENTRYLK:
@@ -2014,13 +1961,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fentrylk_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 args_fentrylk_store (this_args, args->volume, state->fd,
-                                     args->name, args->cmd, args->type,
-                                     this_args->xdata);
+                                     args->name, args->cmd, args->type, xdata);
                 break;
         }
         case GF_FOP_XATTROP:
@@ -2030,18 +1975,16 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_xattrop_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xattr,
-                                              (args->dict.dict_val),
+                                              xattr, (args->dict.dict_val),
                                               (args->dict.dict_len), ret,
                                                op_errno, out);
                 args_xattrop_store (this_args, &state->loc, args->flags,
-                                    this_args->xattr, this_args->xdata);
+                                    xattr, xdata);
                 break;
         }
         case GF_FOP_FXATTROP:
@@ -2051,19 +1994,17 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fxattrop_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xattr,
-                                              (args->dict.dict_val),
+                                              xattr, (args->dict.dict_val),
                                               (args->dict.dict_len), ret,
                                               op_errno, out);
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
-                args_fxattrop_store (this_args, state->fd, args->flags,
-                                     this_args->xattr, this_args->xdata);
+                args_fxattrop_store (this_args, state->fd, args->flags, xattr,
+                                     xdata);
                 break;
         }
         case GF_FOP_FGETXATTR:
@@ -2073,13 +2014,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fgetxattr_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
-                args_fgetxattr_store (this_args, state->fd,
-                                      args->name, this_args->xdata);
+                args_fgetxattr_store (this_args, state->fd, args->name, xdata);
                 break;
         }
         case GF_FOP_FSETXATTR:
@@ -2089,19 +2028,17 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fsetxattr_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xattr,
-                                              (args->dict.dict_val),
+                                              xattr, (args->dict.dict_val),
                                               (args->dict.dict_len), ret,
                                               op_errno, out);
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
-                args_fsetxattr_store (this_args, state->fd, this_args->xattr,
-                                      args->flags, this_args->xdata);
+                args_fsetxattr_store (this_args, state->fd, xattr, args->flags,
+                                      xdata);
                 break;
         }
         case GF_FOP_RCHECKSUM:
@@ -2111,13 +2048,12 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_rchecksum_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
                 args_rchecksum_store (this_args, state->fd, args->offset,
-                                      args->len, this_args->xdata);
+                                      args->len, xdata);
                 break;
         }
         case GF_FOP_SETATTR:
@@ -2127,15 +2063,14 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_setattr_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
                 gf_stat_to_iatt (&args->stbuf, &this_args->stat);
 
                 args_setattr_store (this_args, &state->loc, &this_args->stat,
-                                    args->valid, this_args->xdata);
+                                    args->valid, xdata);
                 break;
         }
         case GF_FOP_FSETATTR:
@@ -2145,15 +2080,14 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fsetattr_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
                 gf_stat_to_iatt (&args->stbuf, &this_args->stat);
 
                 args_fsetattr_store (this_args, state->fd, &this_args->stat,
-                                     args->valid, this_args->xdata);
+                                     args->valid, xdata);
                 break;
         }
         case GF_FOP_READDIRP:
@@ -2163,13 +2097,12 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_readdirp_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xattr,
-                                              (args->dict.dict_val),
+                                              xattr, (args->dict.dict_val),
                                               (args->dict.dict_len), ret,
                                               op_errno, out);
 
                 args_readdirp_store (this_args, state->fd, args->size,
-                                     args->offset, this_args->xattr);
+                                     args->offset, xattr);
                 break;
         }
         case GF_FOP_FREMOVEXATTR:
@@ -2179,13 +2112,12 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fremovexattr_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
                 args_fremovexattr_store (this_args, state->fd, args->name,
-                                         this_args->xdata);
+                                         xdata);
                 break;
         }
 	case GF_FOP_FALLOCATE:
@@ -2195,13 +2127,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_fallocate_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 args_fallocate_store (this_args, state->fd, args->flags,
-                                      args->offset, args->size,
-                                      this_args->xdata);
+                                      args->offset, args->size, xdata);
                 break;
         }
 	case GF_FOP_DISCARD:
@@ -2211,13 +2141,12 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_discard_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
                 args_discard_store (this_args, state->fd, args->offset,
-                                    args->size, this_args->xdata);
+                                    args->size, xdata);
                 break;
         }
         case GF_FOP_ZEROFILL:
@@ -2227,12 +2156,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_zerofill_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
                 args_zerofill_store (this_args, state->fd, args->offset,
-                                     args->size, this_args->xdata);
+                                     args->size, xdata);
                 break;
         }
         case GF_FOP_SEEK:
@@ -2242,12 +2170,11 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_seek_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
-                args_seek_store (this_args, state->fd, args->offset,
-                                 args->what, this_args->xdata);
+                args_seek_store (this_args, state->fd, args->offset, args->what,
+                                 xdata);
                 break;
         }
         case GF_FOP_LEASE:
@@ -2257,21 +2184,23 @@ server_populate_compound_request (gfs3_compound_req *req, call_frame_t *frame,
                 args = &this_req->compound_req_u.compound_lease_req;
 
                 GF_PROTOCOL_DICT_UNSERIALIZE (frame->root->client->bound_xl,
-                                              this_args->xdata,
-                                              args->xdata.xdata_val,
+                                              xdata, args->xdata.xdata_val,
                                               args->xdata.xdata_len, ret,
                                               op_errno, out);
 
                 gf_proto_lease_to_lease (&args->lease, &state->lease);
 
-                args_lease_store (this_args, &state->loc, &state->lease,
-                                  this_args->xdata);
+                args_lease_store (this_args, &state->loc, &state->lease, xdata);
                 break;
         }
         default:
                 return ENOTSUP;
         }
 out:
+        if (xattr)
+                dict_unref (xattr);
+        if (xdata)
+                dict_unref (xdata);
         return op_errno;
 }
 
@@ -3810,7 +3739,6 @@ server_compound_rsp_cleanup (gfs3_compound_rsp *rsp, compound_args_cbk_t *args)
                 return;
 
         len = rsp->compound_rsp_array.compound_rsp_array_len;
-        return;
 
         for (i = 0; i < len; i++) {
                 this_rsp = &rsp->compound_rsp_array.compound_rsp_array_val[i];
@@ -3992,6 +3920,7 @@ server_compound_rsp_cleanup (gfs3_compound_rsp *rsp, compound_args_cbk_t *args)
                         break;
                 }
         }
+        GF_FREE (rsp->compound_rsp_array.compound_rsp_array_val);
         return;
 }
 
-- 
2.9.3