From b167a0ca7f418abd0ff08cf0332593b00e27caee Mon Sep 17 00:00:00 2001 From: Raghavendra G Date: Thu, 5 Jun 2014 10:06:47 +0530 Subject: features/gfid-access: Fix memory leaks. Change-Id: I90f6cdb1c8c4face1bb72a9cc77818d308389e45 BUG: 1104919 Signed-off-by: Raghavendra G Reviewed-on: http://review.gluster.org/7983 Reviewed-by: Pranith Kumar Karampuri Tested-by: Gluster Build System Reviewed-by: Niels de Vos --- xlators/features/gfid-access/src/gfid-access.c | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c index 2d6fbd59fab..7a15165c4a5 100644 --- a/xlators/features/gfid-access/src/gfid-access.c +++ b/xlators/features/gfid-access/src/gfid-access.c @@ -438,8 +438,16 @@ ga_new_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data, if (ret) goto out; - if (!xdata) + if (!xdata) { xdata = dict_new (); + } else { + xdata = dict_ref (xdata); + } + + if (!xdata) { + ret = -1; + goto out; + } ret = ga_fill_tmp_loc (loc, this, gfid, args->bname, xdata, &tmp_loc); @@ -486,6 +494,11 @@ ga_new_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data, out: ga_newfile_args_free (args); + loc_wipe (&tmp_loc); + + if (xdata) + dict_unref (xdata); + return ret; } @@ -509,6 +522,13 @@ ga_heal_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data, if (!xdata) xdata = dict_new (); + else + xdata = dict_ref (xdata); + + if (!xdata) { + ret = -1; + goto out; + } ret = ga_fill_tmp_loc (loc, this, gfid, args->bname, xdata, &tmp_loc); @@ -518,6 +538,7 @@ ga_heal_entry (call_frame_t *frame, xlator_t *this, loc_t *loc, data_t *data, new_frame = copy_frame (frame); if (!new_frame) goto out; + new_frame->local = (void *)frame; STACK_WIND (new_frame, ga_heal_cbk, FIRST_CHILD (this), @@ -529,6 +550,11 @@ out: if (args) ga_heal_args_free (args); + loc_wipe (&tmp_loc); + + if (xdata) + dict_unref (xdata); + return ret; } -- cgit