mgmt/glusterd: Coverity fixes in glusterd-utils.c
Addresses the following CIDs: 1388821: Unchecked return value from sys_lremovexattr() in glusterd_check_and_set_brick_xattr() 1370957: Unused return value in glusterd_volume_tier_use_rsp_dict() 1370950: Memory leak in glusterd_get_global_options_for_all_vols() 1370946: Redundant gf_strdup() leading to a memory leak in glusterd_get_global_options_for_all_vols() Change-Id: I2ab58207bc43b40f004ee18463430a141126bf94 Updates: bz#789278 Signed-off-by: Vijay Bellur <vbellur@redhat.com>
This commit is contained in:
parent
0e5ff35f1e
commit
43f037f6b1
@ -7741,7 +7741,13 @@ glusterd_check_and_set_brick_xattr (char *host, char *path, uuid_t uuid,
|
||||
goto out;
|
||||
|
||||
} else {
|
||||
sys_lremovexattr (path, "trusted.glusterfs.test");
|
||||
ret = sys_lremovexattr (path, "trusted.glusterfs.test");
|
||||
if (ret) {
|
||||
snprintf (msg, sizeof (msg), "Removing test extended"
|
||||
" attribute failed, reason: %s",
|
||||
strerror(errno));
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
|
||||
ret = glusterd_is_path_in_use (path, &in_use, op_errstr);
|
||||
@ -11236,9 +11242,13 @@ glusterd_volume_tier_use_rsp_dict (dict_t *aggr, dict_t *rsp_dict)
|
||||
if (ret) {
|
||||
gf_msg_debug (this->name, errno,
|
||||
"Missing remove-brick-id");
|
||||
} else
|
||||
} else {
|
||||
ret = dict_set_str (ctx_dict, GF_REMOVE_BRICK_TID_KEY,
|
||||
task_id_str);
|
||||
if (ret)
|
||||
gf_msg_debug (this->name, errno,
|
||||
"Failed to set remove brick task ID");
|
||||
}
|
||||
|
||||
ret = 0;
|
||||
|
||||
@ -13173,7 +13183,7 @@ glusterd_get_global_options_for_all_vols (rpcsvc_request_t *req, dict_t *ctx,
|
||||
ALL_VOLUME_OPTION_CHECK ("all", _gf_true, key, ret, op_errstr, out);
|
||||
|
||||
for (i = 0; valid_all_vol_opts[i].option; i++) {
|
||||
allvolopt = gf_strdup (valid_all_vol_opts[i].option);
|
||||
allvolopt = valid_all_vol_opts[i].option;
|
||||
|
||||
if (!all_opts && strcmp (key, allvolopt) != 0)
|
||||
continue;
|
||||
@ -13226,6 +13236,7 @@ glusterd_get_global_options_for_all_vols (rpcsvc_request_t *req, dict_t *ctx,
|
||||
|
||||
if (need_free) {
|
||||
GF_FREE (def_val);
|
||||
need_free = _gf_false;
|
||||
}
|
||||
def_val = NULL;
|
||||
allvolopt = NULL;
|
||||
@ -13248,6 +13259,11 @@ out:
|
||||
if (*op_errstr == NULL)
|
||||
*op_errstr = gf_strdup (err_str);
|
||||
}
|
||||
|
||||
if (ret && need_free) {
|
||||
GF_FREE (def_val);
|
||||
}
|
||||
|
||||
gf_msg_debug (THIS->name, 0, "Returning %d", ret);
|
||||
|
||||
return ret;
|
||||
|
Loading…
x
Reference in New Issue
Block a user