summaryrefslogtreecommitdiffstats
path: root/xlators/features/gfid-access
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2014-06-05 10:06:47 +0530
committerVijay Bellur <vbellur@redhat.com>2014-06-10 02:06:41 -0700
commitf6262b543f0eaa08c2d69310bf2353c9cba009e6 (patch)
tree36573a40136bd5def893ec465784fcd936cf2e73 /xlators/features/gfid-access
parent4b846dbb61fc6f41ba1bb3d52455f1b44e3a656e (diff)
features/gfid-access: Fix memory leaks.
Change-Id: I90f6cdb1c8c4face1bb72a9cc77818d308389e45 BUG: 1104919 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-on: http://review.gluster.org/7982 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Venky Shankar <vshankar@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com>
Diffstat (limited to 'xlators/features/gfid-access')
-rw-r--r--xlators/features/gfid-access/src/gfid-access.c28
1 files changed, 27 insertions, 1 deletions
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;
}