From: Ronnie Sahlberg Date: Thu, 10 May 2007 00:03:21 +0000 (+1000) Subject: update ctdb_control to create a correct ctdb_vnn_map->map array X-Git-Tag: tevent-0.9.20~348^2~2759^2~1 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=82e37a9886bbde41dcf258af128c12ccd32c194f;p=thirdparty%2Fsamba.git update ctdb_control to create a correct ctdb_vnn_map->map array (This used to be ctdb commit e510cc89068557881688d6cada38915b3e51f8cd) --- diff --git a/ctdb/tools/ctdb_control.c b/ctdb/tools/ctdb_control.c index 995f0f3407d..9a893e98f38 100644 --- a/ctdb/tools/ctdb_control.c +++ b/ctdb/tools/ctdb_control.c @@ -799,13 +799,19 @@ static int control_setvnnmap(struct ctdb_context *ctdb, int argc, const char **a generation = strtoul(argv[1], NULL, 0); num_nodes = strtoul(argv[2], NULL, 0); - vnnmap = talloc_zero_size(ctdb, offsetof(struct ctdb_vnn_map, map) + 4*num_nodes); + vnnmap = talloc(ctdb, struct ctdb_vnn_map); if (vnnmap == NULL) { DEBUG(0,(__location__ " Unable to allocate vnn_map structure\n")); exit(1); } vnnmap->generation = generation; vnnmap->size = num_nodes; + vnnmap->map = talloc_array(vnnmap, uint32_t, vnnmap->size); + if (vnnmap->map == NULL) { + DEBUG(0,(__location__ " Unable to allocate vnn_map->map array\n")); + exit(1); + } + for (i=0;isize;i++) { vnnmap->map[i] = strtoul(argv[3+i], NULL, 0); }