summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorAvra Sengupta <asengupt@redhat.com>2016-10-18 12:52:36 +0530
committerRajesh Joseph <rjoseph@redhat.com>2016-11-03 23:05:16 -0700
commit2328a1ca2cab00711efe8f256e532952280f6570 (patch)
tree82c3969eadb0ad63ae38db185aa90435d117f32c /xlators/mgmt/glusterd/src/glusterd-utils.c
parentb0f4fc9d05a1e5169205b88e81ca0fbdd28b3dd2 (diff)
snapshot: Fix for memory leaks in snapshot code path
> Reviewed-on: http://review.gluster.org/15668 > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > Smoke: Gluster Build System <jenkins@build.gluster.org> > Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> (cherry picked from commit 48a4c4e525665115f7e8c478d3bf51764427378d) Change-Id: Idc2cb16574d166e3c0ee1f7c3a485f1acb19fc8c BUG: 1388354 Signed-off-by: Avra Sengupta <asengupt@redhat.com> Reviewed-on: http://review.gluster.org/15720 Smoke: Gluster Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 5bfa809b053..e89ed1102fe 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -865,6 +865,8 @@ glusterd_brickinfo_delete (glusterd_brickinfo_t *brickinfo)
cds_list_del_init (&brickinfo->brick_list);
+ (void) gf_store_handle_destroy (brickinfo->shandle);
+
GF_FREE (brickinfo->logfile);
GF_FREE (brickinfo);
@@ -926,6 +928,9 @@ glusterd_volinfo_delete (glusterd_volinfo_t *volinfo)
dict_unref (volinfo->rebal.dict);
gf_store_handle_destroy (volinfo->quota_conf_shandle);
+ gf_store_handle_destroy (volinfo->shandle);
+ gf_store_handle_destroy (volinfo->node_state_shandle);
+ gf_store_handle_destroy (volinfo->snapd.handle);
glusterd_auth_cleanup (volinfo);
@@ -1054,6 +1059,9 @@ glusterd_get_brick_mount_dir (char *brickpath, char *hostname, char *mount_dir)
}
out:
+ if (mnt_pt)
+ GF_FREE(mnt_pt);
+
gf_msg_trace (this->name, 0, "Returning %d", ret);
return ret;
}
@@ -5601,7 +5609,8 @@ glusterd_add_brick_mount_details (glusterd_brickinfo_t *brickinfo,
ret = dict_set_dynstr_with_alloc (dict, key, entry->mnt_opts);
out:
- GF_FREE (mnt_pt);
+ if (mnt_pt)
+ GF_FREE (mnt_pt);
return ret;
}
@@ -5644,6 +5653,9 @@ glusterd_get_brick_mount_device (char *brick_path)
device = gf_strdup (entry->mnt_fsname);
out:
+ if (mnt_pt)
+ GF_FREE(mnt_pt);
+
return device;
}
@@ -10848,7 +10860,8 @@ glusterd_update_mntopts (char *brick_path, glusterd_brickinfo_t *brickinfo)
ret = 0;
out:
- GF_FREE (mnt_pt);
+ if (mnt_pt)
+ GF_FREE (mnt_pt);
return ret;
}