ctdb: Use provided mem_ctx for newly allocated memory
authorSwen Schillig <swen@vnet.ibm.com>
Wed, 21 Feb 2018 12:34:28 +0000 (13:34 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 30 Mar 2018 22:07:18 +0000 (00:07 +0200)
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@vnet.ibm.com>
Reviewed-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Jeremy Allison <jra@samba.org>
ctdb/client/ctdb_client.c

index d399cb551f68a4d0426f341a2949c7e22172c349..c3bb435a641c258fee9e75c210dcee78d6996dbb 100644 (file)
@@ -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;