summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorMohit Agrawal <moagrawal@redhat.com>2019-06-03 09:49:30 +0530
committerAtin Mukherjee <amukherj@redhat.com>2019-06-04 05:56:11 +0000
commit823c65940912d7b10bcdd495035dbb23b5c99478 (patch)
tree1ebf2ce5f7df2dcc88bbfd9b77991a909ede9d82 /xlators/mgmt/glusterd/src/glusterd-utils.c
parenta36c82375723f51e49c0830d47520392d859c307 (diff)
glusterd: coverity fix
1401716: Resource leak 1401714: Dereference before null check updates: bz#789278 Change-Id: I8fb0b143a1d4b37ee6be7d880d9b5b84ba00bf36 Signed-off-by: Mohit Agrawal <moagrawal@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index eac220a4d57..d7ab6cda6d1 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -4720,10 +4720,12 @@ glusterd_import_friend_volumes_synctask(void *opaque)
GF_ASSERT(conf);
arg = opaque;
+ if (!arg)
+ goto out;
+
peer_data = dict_new();
- if (!peer_data) {
+ if (!peer_data)
goto out;
- }
ret = dict_unserialize(arg->dict_buf, arg->dictlen, &peer_data);
if (ret) {
@@ -4761,10 +4763,11 @@ glusterd_import_friend_volumes_synctask(void *opaque)
out:
if (peer_data)
dict_unref(peer_data);
- if (arg->dict_buf)
- GF_FREE(arg->dict_buf);
- if (arg)
+ if (arg) {
+ if (arg->dict_buf)
+ GF_FREE(arg->dict_buf);
GF_FREE(arg);
+ }
gf_msg_debug("glusterd", 0, "Returning with %d", ret);
return ret;
@@ -4987,6 +4990,9 @@ glusterd_compare_friend_data(dict_t *peer_data, int32_t *status, char *hostname)
}
out:
+ if (ret && arg) {
+ GF_FREE(arg);
+ }
gf_msg_debug(this->name, 0, "Returning with ret: %d, status: %d", ret,
*status);
return ret;