From ada43dc22d158dcc8998bb35497f885951b52159 Mon Sep 17 00:00:00 2001 From: Shwetha Acharya Date: Thu, 15 Nov 2018 15:24:22 +0530 Subject: protocol/client: unchecked return value Problem: In client_process_response_v2, value returned from function client_post_common_dict is not checked for errors before being used. Solution: Added a check condition to resolve the issue. CID: 1390020 Change-Id: I4d297f33c8dd332ae5f6f21667a4871133b2b570 updates: bz#789278 Signed-off-by: Shwetha Acharya --- xlators/protocol/client/src/client-helpers.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'xlators') diff --git a/xlators/protocol/client/src/client-helpers.c b/xlators/protocol/client/src/client-helpers.c index e81f166ba46..c70159fbce1 100644 --- a/xlators/protocol/client/src/client-helpers.c +++ b/xlators/protocol/client/src/client-helpers.c @@ -2889,7 +2889,11 @@ client_process_response_v2(call_frame_t *frame, xlator_t *this, gfx_common_dict_rsp *tmp_rsp = NULL; tmp_rsp = &this_rsp->compound_rsp_v2_u.compound_getxattr_rsp; - client_post_common_dict(this, tmp_rsp, &xattr, &xdata); + ret = client_post_common_dict(this, tmp_rsp, &xattr, &xdata); + if (ret) { + tmp_rsp->op_errno = -ret; + goto out; + } CLIENT4_POST_FOP_TYPE(getxattr, common_dict, this_rsp, this_args_cbk, xattr, xdata); @@ -3004,6 +3008,7 @@ client_process_response_v2(call_frame_t *frame, xlator_t *this, return -ENOTSUP; } +out: if (xdata) dict_unref(xdata); if (xattr) -- cgit