From 1f1850ae79a836f1de783c990e575a0d29e26dee Mon Sep 17 00:00:00 2001 From: Ryan Ding Date: Tue, 23 Aug 2016 17:42:44 +0800 Subject: features/changelog: fix a segment fault in changelog_cleanup_dispatchers the arg 'count' in changelog_cleanup_dispatchers means the thread count to cleanup, so the cleanup loop should start with count-1, not count. change the invoke place also. Change-Id: Ia00853a2e0c5e01e145f60048b1f0ac05f2440ab BUG: 1369397 Signed-off-by: Ryan Ding Reviewed-on: http://review.gluster.org/15293 Smoke: Gluster Build System Reviewed-by: Kotresh HR Tested-by: Kotresh HR Reviewed-by: Milind Changire NetBSD-regression: NetBSD Build System CentOS-regression: Gluster Build System --- xlators/features/changelog/src/changelog-rpc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'xlators/features') diff --git a/xlators/features/changelog/src/changelog-rpc.c b/xlators/features/changelog/src/changelog-rpc.c index 4bc24203118..1d10eccf84f 100644 --- a/xlators/features/changelog/src/changelog-rpc.c +++ b/xlators/features/changelog/src/changelog-rpc.c @@ -18,7 +18,7 @@ static void changelog_cleanup_dispatchers (xlator_t *this, changelog_priv_t *priv, int count) { - for (; count >= 0; count--) { + for (count--; count >= 0; count--) { (void) changelog_thread_cleanup (this, priv->ev_dispatcher[count]); } @@ -112,7 +112,7 @@ changelog_init_rpc_threads (xlator_t *this, changelog_priv_t *priv, ret = pthread_create (&priv->ev_dispatcher[j], NULL, changelog_ev_dispatch, conn); if (ret != 0) { - changelog_cleanup_dispatchers (this, priv, --j); + changelog_cleanup_dispatchers (this, priv, j); break; } } -- cgit