From f6262b543f0eaa08c2d69310bf2353c9cba009e6 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/7982 Reviewed-by: Pranith Kumar Karampuri Tested-by: Gluster Build System Reviewed-by: Venky Shankar Reviewed-by: Vijay Bellur --- xlators/features/gfid-access/src/gfid-access.c | 28 +++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'xlators/features/gfid-access/src') diff --git a/xlators/features/gfid-access/src/gfid-access.c b/xlators/features/gfid-access/src/gfid-access.c index 8adf85bb55b..5be60bfa913 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); + if (xdata) + dict_unref (xdata); + + loc_wipe (&tmp_loc); + 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