From db501c73701b620be67b4c33ea16cac983dcd9b1 Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Sun, 25 Mar 2012 22:48:09 +0530 Subject: core: fix all the iobuf related refs and unrefs reviewed the code against all the possible places where iobuf/iobref ref unref are present, and hopefully fixed most of the issues around memory leaks with respect to iobuf Change-Id: I9aa30326962991f8e23acedd389a0e962e097885 Signed-off-by: Amar Tumballi BUG: 797875 Reviewed-on: http://review.gluster.com/2994 Tested-by: Gluster Build System Reviewed-by: Jeff Darcy Reviewed-by: Vijay Bellur --- glusterfsd/src/glusterfsd-mgmt.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'glusterfsd/src/glusterfsd-mgmt.c') diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c index 058236427..e2622d35d 100644 --- a/glusterfsd/src/glusterfsd-mgmt.c +++ b/glusterfsd/src/glusterfsd-mgmt.c @@ -101,7 +101,6 @@ glusterfs_serialize_reply (rpcsvc_request_t *req, void *arg, outmsg->iov_len = retlen; ret: if (retlen == -1) { - iobuf_unref (iob); iob = NULL; } @@ -123,7 +122,6 @@ glusterfs_submit_reply (rpcsvc_request_t *req, void *arg, goto out; } - if (!iobref) { iobref = iobref_new (); if (!iobref) { @@ -149,7 +147,6 @@ glusterfs_submit_reply (rpcsvc_request_t *req, void *arg, * we can safely unref the iob in the hope that RPC layer must have * ref'ed the iob on receiving into the txlist. */ - iobuf_unref (iob); if (ret == -1) { gf_log (THIS->name, GF_LOG_ERROR, "Reply submission failed"); goto out; @@ -157,10 +154,11 @@ glusterfs_submit_reply (rpcsvc_request_t *req, void *arg, ret = 0; out: + if (iob) + iobuf_unref (iob); - if (new_iobref) { + if (new_iobref && iobref) iobref_unref (iobref); - } return ret; } -- cgit