summaryrefslogtreecommitdiffstats
path: root/xlators/cluster/stripe
diff options
context:
space:
mode:
authorAnand Avati <avati@gluster.com>2010-12-29 12:23:08 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-12-29 10:01:09 -0800
commit818a4d128048721d70be2d6c8eafd2f41034b260 (patch)
treecef7c1ce73fe962d53aae2b797f5f1f279c140a4 /xlators/cluster/stripe
parent98a1f381ba15dfc9c19ea3f9d778e8efb9e6be8e (diff)
stripe: fix memory leak
destroy the frame copied and clean the local structure in stripe to avoid memory leak Signed-off-by: Raghavendra Bhat <raghavendrabhat@gluster.com> Signed-off-by: Anand V. Avati <avati@amp.gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 2253 (Memory leak in glusterfs) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2253
Diffstat (limited to 'xlators/cluster/stripe')
-rw-r--r--xlators/cluster/stripe/src/stripe.c4
-rw-r--r--xlators/cluster/stripe/src/stripe.h16
2 files changed, 15 insertions, 5 deletions
diff --git a/xlators/cluster/stripe/src/stripe.c b/xlators/cluster/stripe/src/stripe.c
index bda38298fc7..639fbfd8b2c 100644
--- a/xlators/cluster/stripe/src/stripe.c
+++ b/xlators/cluster/stripe/src/stripe.c
@@ -203,6 +203,8 @@ stripe_entry_self_heal (call_frame_t *frame, xlator_t *this,
}
out:
+ if (rframe)
+ STRIPE_STACK_DESTROY (rframe);
if (dict)
dict_unref (dict);
@@ -3389,6 +3391,8 @@ stripe_readv (call_frame_t *frame, xlator_t *this, fd_t *fd,
err:
if (local && local->fd)
fd_unref (local->fd);
+ if (rframe)
+ STRIPE_STACK_DESTROY (rframe);
STRIPE_STACK_UNWIND (readv, frame, -1, op_errno, NULL, 0, NULL, NULL);
return 0;
diff --git a/xlators/cluster/stripe/src/stripe.h b/xlators/cluster/stripe/src/stripe.h
index 3dbd93d59f6..6199c006100 100644
--- a/xlators/cluster/stripe/src/stripe.h
+++ b/xlators/cluster/stripe/src/stripe.h
@@ -44,15 +44,21 @@
frame->local = NULL; \
} \
STACK_UNWIND_STRICT (fop, frame, params); \
- stripe_local_wipe(__local); \
+ if (__local) { \
+ stripe_local_wipe(__local); \
+ GF_FREE (__local); \
+ } \
} while (0)
#define STRIPE_STACK_DESTROY(frame) do { \
stripe_local_t *__local = NULL; \
- __local = frame->local; \
- frame->local = NULL; \
- STACK_DESTROY (frame->root); \
- stripe_local_wipe (__local); \
+ __local = frame->local; \
+ frame->local = NULL; \
+ STACK_DESTROY (frame->root); \
+ if (__local) { \
+ stripe_local_wipe (__local); \
+ GF_FREE (__local); \
+ } \
} while (0)
/**