[PATCH] ctdb: Use provided mem_ctx for newly allocated memory

Swen Schillig swen at vnet.ibm.com
Wed Mar 14 06:30:02 UTC 2018


On Wed, 2018-03-14 at 16:08 +1100, Martin Schwenke wrote:
> On Fri, 09 Mar 2018 09:03:46 +0100, Swen Schillig via samba-technical
> <samba-technical at lists.samba.org> wrote:
> 
> > Please review and push if ok.
> 
> I'd prefer not to see the last paragraph about "a pooled context" in
> the commit message.
> 
> Without this:
> 
> Reviewed-by: Martin Schwenke <martin at meltin.net>
> 
> Another team reviewer?
> 
> Thanks...
> 
> peace & happiness,
> martin

Sure. Updated.

Thanks

Cheers Swen.
-------------- next part --------------
From 75b1963b3c41200675bc5283cb6f237abd84aae7 Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at vnet.ibm.com>
Date: Wed, 21 Feb 2018 13:34:28 +0100
Subject: [PATCH] ctdb: Use provided mem_ctx for newly allocated memory

ctdb_call_local is called with a mem_ctx parameter which should be used
for newly allocated memory.

This is safe because all allocations of this context are freed before
this function returns.

Signed-off-by: Swen Schillig <swen at vnet.ibm.com>
---
 ctdb/client/ctdb_client.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index d399cb551f6..c3bb435a641 100644
--- a/ctdb/client/ctdb_client.c
+++ b/ctdb/client/ctdb_client.c
@@ -86,7 +86,7 @@ int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
 	struct ctdb_registered_call *fn;
 	struct ctdb_context *ctdb = ctdb_db->ctdb;
 	
-	c = talloc(ctdb, struct ctdb_call_info);
+	c = talloc(mem_ctx, struct ctdb_call_info);
 	CTDB_NO_MEMORY(ctdb, c);
 
 	c->key = call->key;
-- 
2.14.3



More information about the samba-technical mailing list