From 818a4d128048721d70be2d6c8eafd2f41034b260 Mon Sep 17 00:00:00 2001 From: Anand Avati Date: Wed, 29 Dec 2010 12:23:08 +0000 Subject: stripe: fix memory leak destroy the frame copied and clean the local structure in stripe to avoid memory leak Signed-off-by: Raghavendra Bhat Signed-off-by: Anand V. Avati Signed-off-by: Anand V. Avati BUG: 2253 (Memory leak in glusterfs) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2253 --- xlators/cluster/stripe/src/stripe.h | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) (limited to 'xlators/cluster/stripe/src/stripe.h') diff --git a/xlators/cluster/stripe/src/stripe.h b/xlators/cluster/stripe/src/stripe.h index 3dbd93d59..6199c0061 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) /** -- cgit