From a54390197ac706e3b694c0fe34b8eef10d86d671 Mon Sep 17 00:00:00 2001 From: Ronnie Sahlberg Date: Thu, 10 May 2007 10:10:58 +1000 Subject: [PATCH] create a correct vnnmap structure to prevent a segv (This used to be ctdb commit 17777bb5e6208e97a82a171243c6c406f53ee02e) --- ctdb/direct/ctdb_recoverd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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; -- 2.47.3