fix zero-initialization of header in _ctdbd_allocate_pkt to the correct size
authorMichael Adam <obnox@samba.org>
Thu, 22 Dec 2011 16:18:38 +0000 (17:18 +0100)
committerMichael Adam <obnox@samba.org>
Fri, 23 Dec 2011 16:39:00 +0000 (17:39 +0100)
(This used to be ctdb commit 6c4d1b768ccade344a7462ecad7cf5cbbf3873d4)

ctdb/client/ctdb_client.c

index 224cdc03ee472b218707b0fbe9bacef211ac86e9..a580a3e380401e3bd0d15a340285d4ca0b978cc0 100644 (file)
@@ -47,14 +47,13 @@ struct ctdb_req_header *_ctdbd_allocate_pkt(struct ctdb_context *ctdb,
        length = MAX(length, slength);
        size = (length+(CTDB_DS_ALIGNMENT-1)) & ~(CTDB_DS_ALIGNMENT-1);
 
-       hdr = (struct ctdb_req_header *)talloc_size(mem_ctx, size);
+       hdr = (struct ctdb_req_header *)talloc_zero_size(mem_ctx, size);
        if (hdr == NULL) {
                DEBUG(DEBUG_ERR,("Unable to allocate packet for operation %u of length %u\n",
                         operation, (unsigned)length));
                return NULL;
        }
        talloc_set_name_const(hdr, type);
-       memset(hdr, 0, slength);
        hdr->length       = length;
        hdr->operation    = operation;
        hdr->ctdb_magic   = CTDB_MAGIC;