[PATCH] ctdb: Use talloc_zero instead of zeroing attributes

Swen Schillig swen at vnet.ibm.com
Fri Mar 9 08:04:35 UTC 2018


Please review and push if OK.

Thanks in advance.

Cheers Swen
-------------- next part --------------
From 6f0c8d622956dea61272b5674390cd810198858d Mon Sep 17 00:00:00 2001
From: Swen Schillig <swen at vnet.ibm.com>
Date: Wed, 21 Feb 2018 13:52:11 +0100
Subject: [PATCH] ctdb: Use talloc_zero instead of zeroing attributes

Zero entire structure with talloc_zero on memory allocation instead of
setting each attribute individually.

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

diff --git a/ctdb/client/ctdb_client.c b/ctdb/client/ctdb_client.c
index c3bb435a641..a7624b7e3c8 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(mem_ctx, struct ctdb_call_info);
+	c = talloc_zero(mem_ctx, struct ctdb_call_info);
 	CTDB_NO_MEMORY(ctdb, c);
 
 	c->key = call->key;
@@ -94,9 +94,6 @@ int ctdb_call_local(struct ctdb_db_context *ctdb_db, struct ctdb_call *call,
 	c->record_data.dptr = talloc_memdup(c, data->dptr, data->dsize);
 	c->record_data.dsize = data->dsize;
 	CTDB_NO_MEMORY(ctdb, c->record_data.dptr);
-	c->new_data = NULL;
-	c->reply_data = NULL;
-	c->status = 0;
 	c->header = header;
 
 	for (fn=ctdb_db->calls;fn;fn=fn->next) {
-- 
2.14.3



More information about the samba-technical mailing list