ctdb: Use talloc_zero instead of zeroing attributes
authorSwen Schillig <swen@vnet.ibm.com>
Wed, 21 Feb 2018 12:52:11 +0000 (13:52 +0100)
committerJeremy Allison <jra@samba.org>
Fri, 30 Mar 2018 22:07:18 +0000 (00:07 +0200)
Zero entire structure with talloc_zero on memory allocation instead of
setting each attribute individually.

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 c3bb435a641c258fee9e75c210dcee78d6996dbb..a7624b7e3c86d985693960688722c7cf2014842e 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(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) {