summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/afr/src/afr.c
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2009-12-04 04:52:33 +0000
committerAnand V. Avati <avati@dev.gluster.com>2009-12-04 02:52:00 -0800
commit05ad7717083057de819ad545591bffeb8af2f741 (patch)
treea6218ced4773af8b6d02940688ccb2ec9391a5c3 /xlators/cluster/afr/src/afr.c
parent349f9b77178aac3d2823bb35b0dc6c40b7a3b876 (diff)
afr: fix memory leaks
Signed-off-by: Anand V. Avati <avati@blackhole.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 170 (Auto-heal fails on files that are open()-ed/mmap()-ed) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=170
Diffstat (limited to 'xlators/cluster/afr/src/afr.c')
-rw-r--r--xlators/cluster/afr/src/afr.c45
1 files changed, 31 insertions, 14 deletions
diff --git a/xlators/cluster/afr/src/afr.c b/xlators/cluster/afr/src/afr.c
index f81b8005d..57af6f342 100644
--- a/xlators/cluster/afr/src/afr.c
+++ b/xlators/cluster/afr/src/afr.c
@@ -289,19 +289,12 @@ afr_local_sh_cleanup (afr_local_t *local, xlator_t *this)
}
-void
-afr_local_cleanup (afr_local_t *local, xlator_t *this)
+void
+afr_local_transaction_cleanup (afr_local_t *local, xlator_t *this)
{
- int i;
+ int i = 0;
afr_private_t * priv = NULL;
- if (!local)
- return;
-
- afr_local_sh_cleanup (local, this);
-
- FREE (local->child_errno);
-
priv = this->private;
for (i = 0; i < priv->child_count; i++) {
@@ -311,17 +304,35 @@ afr_local_cleanup (afr_local_t *local, xlator_t *this)
FREE (local->pending);
- loc_wipe (&local->loc);
- loc_wipe (&local->newloc);
-
FREE (local->transaction.locked_nodes);
FREE (local->transaction.child_errno);
+ FREE (local->child_errno);
FREE (local->transaction.basename);
FREE (local->transaction.new_basename);
- loc_wipe (&local->transaction.parent_loc);
+ loc_wipe (&local->transaction.parent_loc);
loc_wipe (&local->transaction.new_parent_loc);
+}
+
+
+void
+afr_local_cleanup (afr_local_t *local, xlator_t *this)
+{
+ int i;
+ afr_private_t * priv = NULL;
+
+ if (!local)
+ return;
+
+ afr_local_sh_cleanup (local, this);
+
+ afr_local_transaction_cleanup (local, this);
+
+ priv = this->private;
+
+ loc_wipe (&local->loc);
+ loc_wipe (&local->newloc);
if (local->fd)
fd_unref (local->fd);
@@ -1422,6 +1433,12 @@ afr_release (xlator_t *this, fd_t *fd)
if (fd_ctx->child_failed)
FREE (fd_ctx->child_failed);
+ if (fd_ctx->pre_op_done)
+ FREE (fd_ctx->pre_op_done);
+
+ if (fd_ctx->opened_on)
+ FREE (fd_ctx->opened_on);
+
FREE (fd_ctx);
}