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>
Thu, 12 Jan 2012 07:50:31 +0000 (08:50 +0100)
(cherry picked from commit 6c4d1b768ccade344a7462ecad7cf5cbbf3873d4)

client/ctdb_client.c

index a8c011acdb90e43554c0274e23dacbcb6319b192..94fc712972082bd8a403e618fc658b1701ee7f0c 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;