summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMohammed Rafi KC <rkavunga@redhat.com>2016-08-02 11:59:42 +0530
committerPranith Kumar Karampuri <pkarampu@redhat.com>2016-08-08 03:56:26 -0700
commit3ec31ff213de643df27dc1f107d876315c3357ae (patch)
treee540bd8997fb5fa0d18fb9cf5d2f45961ae22b96
parent7922599e4dbad6958f939d0ffd222dfa7c786e57 (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 > Reviewed-on: http://review.gluster.org/15068 > Smoke: Gluster Build System <jenkins@build.gluster.org> > CentOS-regression: Gluster Build System <jenkins@build.gluster.org> > NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> > Reviewed-by: Pranith Kumar Karampuri <pkarampu@redhat.com> > Reviewed-by: Poornima G <pgurusid@redhat.com> BUG: 1364506 Change-Id: Ieb413267604d9870dbe6e11258fffd279a7bd7cf Signed-off-by: Mohammed Rafi KC <rkavunga@redhat.com> Signed-off-by: Oleksandr Natalenko <oleksandr@natalenko.name> Reviewed-on: http://review.gluster.org/15102 Smoke: Gluster Build System <jenkins@build.gluster.org> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.org> Reviewed-by: Prashanth Pai <ppai@redhat.com> Reviewed-by: Pranith Kumar Karampuri <pkarampu@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 c34055b..384c0e1 100644
--- a/xlators/meta/src/meta-defaults.c
+++ b/xlators/meta/src/meta-defaults.c
@@ -153,6 +153,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);
@@ -164,6 +167,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;
}