diff options
author | Xavier Hernandez <xhernandez@datalab.es> | 2014-08-08 09:47:10 +0200 |
---|---|---|
committer | Vijay Bellur <vbellur@redhat.com> | 2015-01-09 09:43:33 -0800 |
commit | 71844788a1da0249201b27109e3ea00599569b93 (patch) | |
tree | 774dee8c8aed770bef647e681fa26c97c790877e | |
parent | bbb4b7679be26ed5460524bcf26e779f6907d299 (diff) |
protocol/server: Fix possible memory leaks of xdata
There was a memory leak of xdata argument in fops (f)setxattr,
(f)xattrop and statfs. This leak was minor because xdata is
rarely, or even not used at all, in this fops.
Change-Id: Ie1083ae227755a11cf72f8d89595520a5afb3042
BUG: 1127653
Signed-off-by: Xavier Hernandez <xhernandez@datalab.es>
Reviewed-on: http://review.gluster.org/8434
Reviewed-by: Niels de Vos <ndevos@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
-rw-r--r-- | xlators/protocol/server/src/server-rpc-fops.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/xlators/protocol/server/src/server-rpc-fops.c b/xlators/protocol/server/src/server-rpc-fops.c index 7288fab5374..902a8e5f6b8 100644 --- a/xlators/protocol/server/src/server-rpc-fops.c +++ b/xlators/protocol/server/src/server-rpc-fops.c @@ -4321,7 +4321,9 @@ server3_3_setxattr (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_setxattr_resume); - return ret; + /* 'dict' will be destroyed later when 'state' is not needed anymore */ + dict = NULL; + out: free (args.xdata.xdata_val); @@ -4395,7 +4397,9 @@ server3_3_fsetxattr (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_fsetxattr_resume); - return ret; + /* 'dict' will be destroyed later when 'state' is not needed anymore */ + dict = NULL; + out: free (args.xdata.xdata_val); @@ -4469,7 +4473,8 @@ server3_3_fxattrop (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_fxattrop_resume); - return ret; + /* 'dict' will be destroyed later when 'state' is not needed anymore */ + dict = NULL; out: free (args.xdata.xdata_val); @@ -4544,7 +4549,9 @@ server3_3_xattrop (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_xattrop_resume); - return ret; + /* 'dict' will be destroyed later when 'state' is not needed anymore */ + dict = NULL; + out: free (args.xdata.xdata_val); @@ -6101,6 +6108,8 @@ server3_3_statfs (rpcsvc_request_t *req) ret = 0; resolve_and_resume (frame, server_statfs_resume); out: + free (args.xdata.xdata_val); + if (op_errno) SERVER_REQ_SET_ERROR (req, ret); |