mirror of
https://github.com/samba-team/samba.git
synced 2025-03-22 02:50:28 +03:00
create a correct vnnmap structure to prevent a segv
(This used to be ctdb commit 17777bb5e6208e97a82a171243c6c406f53ee02e)
This commit is contained in:
parent
82e37a9886
commit
a54390197a
@ -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;i<nodemap->num;i++) {
|
||||
if (nodemap->nodes[i].flags&NODE_FLAGS_CONNECTED) {
|
||||
vnnmap->map[j++]=nodemap->nodes[i].vnn;
|
||||
|
Loading…
x
Reference in New Issue
Block a user