]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
create a correct vnnmap structure to prevent a segv
authorRonnie Sahlberg <sahlberg@ronnie>
Thu, 10 May 2007 00:10:58 +0000 (10:10 +1000)
committerRonnie Sahlberg <sahlberg@ronnie>
Thu, 10 May 2007 00:10:58 +0000 (10:10 +1000)
(This used to be ctdb commit 17777bb5e6208e97a82a171243c6c406f53ee02e)

ctdb/direct/ctdb_recoverd.c

index 947f47b29fe871f634c8a5185fd0949629af8354..9c5c73923293f74b4c15334e3b0beecfc6a97942 100644 (file)
@@ -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;