summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaghavendra G <rgowdapp@redhat.com>2014-06-05 10:06:47 +0530
committerNiels de Vos <ndevos@redhat.com>2014-06-10 02:37:49 -0700
commitb167a0ca7f418abd0ff08cf0332593b00e27caee (patch)
treead66c344da31b4a68a2fe9318ee1f95ea572195b
parentde19f3952b9e9a22db9b4af55e74b557aa71bae9 (diff)
features/gfid-access: Fix memory leaks.v3.5.1beta2
Change-Id: I90f6cdb1c8c4face1bb72a9cc77818d308389e45 BUG: 1104919 Signed-off-by: Raghavendra G <rgowdapp@redhat.com> Reviewed-on: http://review.gluster.org/7983 Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-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 2d6fbd5..7a15165 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;
}