[PATCH] Set initialized in dbwrap_ctdb

Ralph Böhme slow at samba.org
Sat May 6 17:05:13 UTC 2017


Hi!

Amitay spotted an obvious bug in dbwrap_ctdb in code recently added by me: when
initializing the new async ctx the "initialized" flag was never set to true.

Please review & push if ok. Thanks Amitay for spotting this!

-slow
-------------- next part --------------
From 27f575df47d0db604a5cb6536ba4393a30a0e27d Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Fri, 5 May 2017 22:30:32 +0200
Subject: [PATCH 1/2] s3/dbwrap_ctdb: set async_ctx to initialized

After initializing the async connection to ctdb we must set initialized
to true.

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/lib/dbwrap/dbwrap_ctdb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index 87ac8e1..cc89e93 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -109,6 +109,7 @@ static int ctdb_async_ctx_init_internal(TALLOC_CTX *mem_ctx,
 		return ret;
 	}
 
+	ctdb_async_ctx.initialized = true;
 	return 0;
 }
 
-- 
2.9.3


From 651223c4899e9ea49f1e7214625f6a4006a2c6ac Mon Sep 17 00:00:00 2001
From: Ralph Boehme <slow at samba.org>
Date: Fri, 5 May 2017 22:31:54 +0200
Subject: [PATCH 2/2] s3/dbwrap_ctdb: free resources in an error code path

Signed-off-by: Ralph Boehme <slow at samba.org>
---
 source3/lib/dbwrap/dbwrap_ctdb.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/source3/lib/dbwrap/dbwrap_ctdb.c b/source3/lib/dbwrap/dbwrap_ctdb.c
index cc89e93..10fe88d 100644
--- a/source3/lib/dbwrap/dbwrap_ctdb.c
+++ b/source3/lib/dbwrap/dbwrap_ctdb.c
@@ -106,6 +106,7 @@ static int ctdb_async_ctx_init_internal(TALLOC_CTX *mem_ctx,
 	ret = ctdbd_setup_fde(ctdb_async_ctx.async_conn, ev);
 	if (ret != 0) {
 		DBG_ERR("ctdbd_setup_ev failed\n");
+		TALLOC_FREE(ctdb_async_ctx.async_conn);
 		return ret;
 	}
 
-- 
2.9.3



More information about the samba-technical mailing list