From: Ronnie Sahlberg Date: Thu, 10 May 2007 00:10:58 +0000 (+1000) Subject: create a correct vnnmap structure to prevent a segv X-Git-Tag: tevent-0.9.20~348^2~2759^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a54390197ac706e3b694c0fe34b8eef10d86d671;p=thirdparty%2Fsamba.git create a correct vnnmap structure to prevent a segv (This used to be ctdb commit 17777bb5e6208e97a82a171243c6c406f53ee02e) --- diff --git a/ctdb/direct/ctdb_recoverd.c b/ctdb/direct/ctdb_recoverd.c index 947f47b29fe..9c5c7392329 100644 --- a/ctdb/direct/ctdb_recoverd.c +++ b/ctdb/direct/ctdb_recoverd.c @@ -408,13 +408,14 @@ static int do_recovery(struct ctdb_context *ctdb, struct event_context *ev, /* build a new vnn map with all the currently active nodes */ - vnnmap = talloc_zero_size(mem_ctx, offsetof(struct ctdb_vnn_map, map) + 4*num_active); + vnnmap = talloc(mem_ctx, struct ctdb_vnn_map); if (vnnmap == NULL) { DEBUG(0,(__location__ " Unable to allocate vnn_map structure\n")); return -1; } vnnmap->generation = generation; vnnmap->size = num_active; + vnnmap->map = talloc_array(vnnmap, uint32_t, sizeof(uint32_t)*num_active); for (i=j=0;inum;i++) { if (nodemap->nodes[i].flags&NODE_FLAGS_CONNECTED) { vnnmap->map[j++]=nodemap->nodes[i].vnn;