[PATCH] timer: fix ctx->timer memleak

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Zqiang <qiang.zhang@xxxxxxxxxxxxx>

If create timer thread failed, the 'ctx->timer' need
to be released.

Signed-off-by: Zqiang <qiang.zhang@xxxxxxxxxxxxx>
---
 libglusterfs/src/timer.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/libglusterfs/src/timer.c b/libglusterfs/src/timer.c
index 66c861b04c..2684d39667 100644
--- a/libglusterfs/src/timer.c
+++ b/libglusterfs/src/timer.c
@@ -213,6 +213,12 @@ gf_timer_registry_init(glusterfs_ctx_t *ctx)
     if (ret) {
         gf_msg(THIS->name, GF_LOG_ERROR, ret, LG_MSG_PTHREAD_FAILED,
                "Thread creation failed");
+	LOCK(&ctx->lock);
+	reg = ctx->timer;
+	ctx->timer = NULL;
+	UNLOCK(&ctx->lock);
+	GF_FREE(reg);
+	reg = NULL;
     }
 
 out:
-- 
2.25.1

-------

Community Meeting Calendar:
Schedule -
Every 2nd and 4th Tuesday at 14:30 IST / 09:00 UTC
Bridge: https://meet.google.com/cpu-eiue-hvk

Gluster-devel mailing list
Gluster-devel@xxxxxxxxxxx
https://lists.gluster.org/mailman/listinfo/gluster-devel




[Index of Archives]     [Gluster Users]     [Ceph Users]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux