glusterd: fix resource leak coverity issues

This patch addresses CID 1288098,1370948 and 1382454

key_fixed is allocated with memory but missed to free it.

updates: bz#789278
Change-Id: Iea805c668ba89759313f9e21b328757e570be97b
Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
This commit is contained in:
Sanju Rakonde 2018-09-21 11:55:12 +05:30 committed by Atin Mukherjee
parent 27402fcb27
commit 28bc9e4bf7
3 changed files with 4 additions and 8 deletions

View File

@ -4988,6 +4988,7 @@ out:
&rsp.dict.dict_len);
glusterd_submit_reply(req, &rsp, NULL, 0, NULL, (xdrproc_t)xdr_gf_cli_rsp);
GF_FREE(key_fixed);
return ret;
}

View File

@ -1684,16 +1684,11 @@ glusterd_op_stage_reset_volume(dict_t *dict, char **op_errstr)
goto out;
} else if (strcmp(key, "cluster.watermark-low") == 0) {
ret = glusterd_water_limit_check(volinfo, _gf_false, op_errstr);
if (ret)
return ret;
} else if (strcmp(key, "cluster.watermark-hi") == 0) {
ret = glusterd_water_limit_check(volinfo, _gf_true, op_errstr);
if (ret) {
if (key_fixed)
GF_FREE(key_fixed);
return ret;
}
}
if (ret)
goto out;
if (!exists) {
ret = snprintf(msg, sizeof(msg), "Option %s does not exist", key);

View File

@ -13137,7 +13137,7 @@ out:
if (ret && need_free) {
GF_FREE(def_val);
}
GF_FREE(key_fixed);
gf_msg_debug(THIS->name, 0, "Returning %d", ret);
return ret;