summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2016-08-02 11:59:42 +0530
committerNiels de Vos <ndevos@redhat.com>2016-08-13 01:07:53 -0700
commitba7a337ab250761492b153c1caee0c21b28e08a1 (patch)
tree70aaf2b5172d3ddf8749814adbb31dcd58acbc52
parentdae860ab7e1c5a205646393f2cb80a0a06986c30 (diff)
meta: fix memory leak in meta xlators
meta xlator is leaking iobuf and iobrefs in read path This patch fixes memleak in meta_default_read code path Backport of> >Change-Id: Ieb413267604d9870dbe6e11258fffd279a7bd7cf >BUG: 1362397 >Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> >Reviewed-on: http://review.gluster.org/15068 >Smoke: Gluster Build System <jenkins@build.gluster.org> >Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> >CentOS-regression: Gluster Build System <jenkins@build.gluster.org> >NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> >Reviewed-by: Poornima G <pgurusid@redhat.com> (cherry picked from commit d297d2bdfc4d5ba99c37b22dd1ae0f8e8e92fe7b) Change-Id: I1141d3770f2d0f24ac5954d12a6bb3cc4a900f44 BUG: 1365734 Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Reviewed-on: http://review.gluster.org/15123 Smoke: Gluster Build System <jenkins@build.gluster.org> Tested-by: Oleksandr Natalenko <oleksandr@natalenko.name> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Reviewed-by: Prashanth Pai <ppai@redhat.com> Reviewed-by: Niels de Vos <ndevos@redhat.com>
-rw-r--r--xlators/meta/src/meta-defaults.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/xlators/meta/src/meta-defaults.c b/xlators/meta/src/meta-defaults.c
index 5a8558291ba..045fe79dbbc 100644
--- a/xlators/meta/src/meta-defaults.c
+++ b/xlators/meta/src/meta-defaults.c
@@ -148,6 +148,9 @@ meta_default_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
return default_readv_failure_cbk (frame, ENOMEM);
}
+ /* iobref would have taken a ref */
+ iobuf_unref (iobuf);
+
iov.iov_base = iobuf_ptr (iobuf);
copy_offset = min (meta_fd->size, offset);
@@ -159,6 +162,8 @@ meta_default_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
META_STACK_UNWIND (readv, frame, copy_size, 0, &iov, 1, &iatt, iobref, 0);
+ iobref_unref (iobref);
+
return 0;
}