|
|
e3c68b |
From 0d8c6d78130d22c475010bcce8055073b19de82a Mon Sep 17 00:00:00 2001
|
|
|
e3c68b |
From: Xie Changlong <xiechanglong@cmss.chinamobile.com>
|
|
|
e3c68b |
Date: Fri, 17 May 2019 18:33:11 +0800
|
|
|
e3c68b |
Subject: [PATCH 358/362] inode: fix wrong loop count in __inode_ctx_free
|
|
|
e3c68b |
|
|
|
e3c68b |
Avoid serious memory leak
|
|
|
e3c68b |
|
|
|
e3c68b |
Backport of :
|
|
|
e3c68b |
>fixes: bz#1711240
|
|
|
e3c68b |
>Upstream patch link: https://review.gluster.org/#/c/glusterfs/+/22738/
|
|
|
e3c68b |
>Change-Id: Ic61a8fdd0e941e136c98376a87b5a77fa8c22316
|
|
|
e3c68b |
>Signed-off-by: Xie Changlong <xiechanglong@cmss.chinamobile.com>
|
|
|
e3c68b |
|
|
|
e3c68b |
BUG: 1781543
|
|
|
e3c68b |
Change-Id: I601ebb6cd6744a61c64edd3d21d3b9a0edf1e95b
|
|
|
e3c68b |
Signed-off-by: Rinku Kothiya <rkothiya@redhat.com>
|
|
|
e3c68b |
Reviewed-on: https://code.engineering.redhat.com/gerrit/195611
|
|
|
e3c68b |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
e3c68b |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
e3c68b |
---
|
|
|
e3c68b |
libglusterfs/src/inode.c | 11 ++++++-----
|
|
|
e3c68b |
1 file changed, 6 insertions(+), 5 deletions(-)
|
|
|
e3c68b |
|
|
|
e3c68b |
diff --git a/libglusterfs/src/inode.c b/libglusterfs/src/inode.c
|
|
|
e3c68b |
index 5331e93..9dbb25b 100644
|
|
|
e3c68b |
--- a/libglusterfs/src/inode.c
|
|
|
e3c68b |
+++ b/libglusterfs/src/inode.c
|
|
|
e3c68b |
@@ -402,14 +402,15 @@ __inode_ctx_free(inode_t *inode)
|
|
|
e3c68b |
goto noctx;
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
- for (index = 0; index < inode->table->xl->graph->xl_count; index++) {
|
|
|
e3c68b |
+ for (index = 0; index < inode->table->ctxcount; index++) {
|
|
|
e3c68b |
if (inode->_ctx[index].value1 || inode->_ctx[index].value2) {
|
|
|
e3c68b |
xl = (xlator_t *)(long)inode->_ctx[index].xl_key;
|
|
|
e3c68b |
- old_THIS = THIS;
|
|
|
e3c68b |
- THIS = xl;
|
|
|
e3c68b |
- if (!xl->call_cleanup && xl->cbks->forget)
|
|
|
e3c68b |
+ if (xl && !xl->call_cleanup && xl->cbks->forget) {
|
|
|
e3c68b |
+ old_THIS = THIS;
|
|
|
e3c68b |
+ THIS = xl;
|
|
|
e3c68b |
xl->cbks->forget(xl, inode);
|
|
|
e3c68b |
- THIS = old_THIS;
|
|
|
e3c68b |
+ THIS = old_THIS;
|
|
|
e3c68b |
+ }
|
|
|
e3c68b |
}
|
|
|
e3c68b |
}
|
|
|
e3c68b |
|
|
|
e3c68b |
--
|
|
|
e3c68b |
1.8.3.1
|
|
|
e3c68b |
|